Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot connect to GitHub with 2FA / SSH using SourceTree 3.0

I'm trying to setup sourcetree 3 on a new Mac. I already had my SSH key created and added to GitHub prior to installing SourceTree. When i go into the accounts section in sourcetree and try to add my GitHub account with SSH, I get a message during the "connect" phase that says "There was a problem adding your new SSH key to your GitHub account". GitHub doesn't allow adding the same key twice so i tried removing it on their end but it still didn't help. I get the same message. Obviously source tree won't let me pull because of credentials errors. This was really easy with Personal Access tokens in SourceTree 2...what can I try in SourceTree 3 to get this to connect?


2 answers

2 votes
Manju Atlassian Team Dec 18, 2018

You can login to GitHub on Sourcetree using OAuth and post that use either your own ssh key or a new ssh key generated from Sourcetree. If this key isn't already present on the host, it will be uploaded to GitHub by Sourcetree. 

Lastly, Please check if the ssh-agent has your keys loaded. If not, please add them to the agent. 

Run below commands in terminal to do so,

To check if keys are loaded:

ssh-add -l

To add keys to agent:

ssh-add <path_to_key>

more like,

ssh-add ~/.ssh/id_rsa

Key in the passphrase used while generating the ssh key and you should be good to go.

Thanks Manjunath,

For some reason my ssh key was not added to the agent. I thought this had been done. I added it successfully but it still doesnt fix the issue. I get authentication errors if a try to pull from my remote repo and if i go into the accounts panel and connect with github using my I get the same error saying "There was a problem adding your new SSH key to your GitHub account". I assume the error with adding the new key is because the key already exists on GitHub but if i delete the SSH key on GitHub, SourceTree still reports that there is an error adding it. So i do what it says and add it manually but still get nothing.

Like # people like this

For the record, having SourceTree generate a key gives the same error about being unable to add it to github.

Like Peter Campbell likes this

Hi Jason,

I am also facing same issue as yours.

Did you get any solution to this problem?

Make sure the origin is not using https and its just git@github SSH option. Had the same issue and at some point it made a weird switch.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,274 views 5 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you