Testing your SSH authentication

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

How To test your SSH authentication

There are two ways to test your SSH connection.  This one uses the ssh client:

$ ssh -t git@bitbucket.org 

This command can use any git command.  We use git pull here assuming git remote is configured correctly

GIT_SSH_COMMAND="ssh -vvv" git pull

If contacting support, save the full text of this connection to the ticket.

How to read these logs:

For a fuller description of the logs, please see Troubleshooting SSH issues.

Some Client side troubleshooting

These are some issues on an SSH client.

To check whether you're running multiple versions of the ssh-agent

Enter ps at the command line when you have at least one loaded SSH key.

$ ps 
  PID PPID PGID  WINPID TTY UID STIME COMMAND
  5192  1 5192  5192 ? 500 19:23:34 /bin/ssh-agent
  5840  1 5840  5840 con 500 08:38:20 /bin/sh
  6116 5840 6116  1336 con 500 08:38:22 /bin/ps      

The previous response shows only one running ssh-agent:

  • /bin/ssh-agent – The running ssh-agent.

  • /bin/sh – The shell you're in.

  • /bin/ps – The process you're running.

If this response returns more than one ssh-agent, kill all versions of the agents and restart ssh-agent.

To kill each version, use the kill command and the process ID, which is 5192 in the previous example:

$ kill 5192

To restart the ssh-agent, run: $ eval 'ssh-agent'

To check that the SSH key you want to use is loaded

To list your loaded keys, enter ssh-add -l (that's the letter, not the number). This example returns two different keys:

$ ssh-add -l 
2048 4c:80:61:2c:00:3f:9d:dc:08:41:2e:c0:cf:b9:17:69 /Users/manthony/.ssh/workid (RSA)
2048 7a:9c:b2:9c:8e:4e:f4:af:de:70:77:b9:52:fd:44:97 /Users/manthony/.ssh/personalid (RSA)      

If you don't see the SSH key you want to use, add it by entering ssh-add followed by the path to the private key file:

$ ssh-add ~/.ssh/<private_key_file> 

If you're still having problems, try removing all the SSH keys that you don't want to use:

$ ssh-add -d ~/.ssh/<private_key_file>

On Windows using Sourcetree

Double click the Pageant icon in your system tray to open the Pagent Key List dialog.
If you don't see your SSH key, click Add Key to add it.

To check that the ssh-agent is running

Enter ps -e  | grep [s]sh-agent to check whether it's running. If the ssh-agent is running, you'll see the following response:

$ ps -e  | grep [s]sh-agent
 9060 ??         0:00.28 /usr/bin/ssh-agent -l

If the agent isn't running, the terminal doesn't return anything. If that's the case, start the agent manually with the following command:

$ ssh-agent /bin/bash 

On Windows using Sourcetree

Make sure Pageant is running in your system tray:

Click Add Key to add any key not included in the list.

Last modified on Dec 12, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.