Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using Sourcetree with GitHub: Having Trouble Adding an SSH Key to My GitHub Account

Tom Bluewater October 20, 2020

sourceTree.jpg

I'm trying to use Sourcetree (for macOS) with GitHub. The followings are the steps that I have taken many times after visiting a dozen websites include this Japanese article. I thought it's well-written. But it doesn't work for me.

1. ssh-keygen -t rsa -C xxx where xxx is my e-mail address as a comment

2. Location: /Users/yyy/.ssh/id_rsa where yyy is my user account name

3. I enter a pass phrase twice.

4. cd ~/.ssh

5. chmod 600 id_rsa

6. I edit the config file in the .ssh folder as follows.

Host github.com

HostName github.com

IdentityFile ~/.ssh/id_rsa

User git

7. ssh-add -K

8. pbcopy < ~/.ssh/id_rsa.pub

9. I go to github.com and enter the key that I copied into the clipboard under the SSH and GPG keys section of the sidebar.

10.Switching Sourcetree, I create a new account. The host is GitHub. Auth Type is OAuth. I then click on Connect Account. The protocol is set to SSH.

And Sourcetree says Upload Failed There was a problem adding your new SSH key to your GitHub account. Please add this manually via their website.  Does anybody know what I'm doing wrong? I've followed the steps with two different computers. And I can't go any further.

Lastly, I do have my private and public keys in the .ssh folder.  My macOS version is 10.15.4.  And the Sourcetree is 4.0.2 (236), which is installed on a brand-new iMac and as well as on a 7-year-old iMac.

 

Thanks.

2 answers

1 accepted

1 vote
Answer accepted
Tom Bluewater October 20, 2020

I've solved the problem for myself.  I need to select Basic as Auth Type.

6 votes
cilhao
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 21, 2021

The problem has nothing to do with SSH!

The problem is that you have enabled your two factor authentication and Sourcetree is not able to connect. You must go to your GitHub account and create a Personal Access Token in Developer Settings, after that you go to you Sourcetree and edit the Auth Type of your GitHub account to Basic, fill your username and paste your newly created Access Token instead of your password, this will bypass the second factor of authentication.

Allan Dowdeswell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2021

This helped me, thanks!

Like cilhao likes this
binla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 27, 2021

Thanks!! my problem has been solved by your solution.

Like cilhao likes this
TheKingArthas August 2, 2021

Thanks cilhao, this solved my issue!

Like cilhao likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events