Can't add Github Account to Sourcetree
Asked by Gabriel Asman:

I have a Github account (2FA enabled) that I would like to add to Sourcetree (on MacOs). I have tried every conceivable combination of OAuth/BasicAuth, SSH/HTTPs and Personal Access Token that I can think of - to no success.  

(The particular way it fails is different for each configuration of the above - sometimes it continually ask for details when attempting fetch the list of repositories, other times it just gets stuck while loading the cloning of a project)  

Noteworthy, this was working just fine until a few days ago, and based on other glitches I've been dealing with, I highly suspect the this was caused by a recent OS update (updated to High Sierra)  

Has anyone encountered similar issues - and is anyone aware of a remedy? Or, am I overlooking something important?


Answers:
author: Manju
body: Hi,

It would be helpful to diagnose this if you can provide specific error messages.

However, I would recommend you to remove any old keychain items for GitHub and remove the account from Sourcetree too and add it again.

This time, please use OAuth/https combination. Make sure to verify the new keychain items are written and also an encrypted file with the file name format \<username\>@STAuth-github.com is written at location \~/Library/Application Support/SourceTree/

If something is missing, please try again after restarting the mac. This helps fixing permissions with keychain.

Feel free to revert back with any error you encounter.

Thanks!

comments: author: Gabriel Asman
body: Thank you very much - this worked for now, removing the account \& the keychain items \& restarting the Macbook. (Think I'd previously tried this without the restart)  

Cheers!


author: Ryan Sherman
body: I tried the same thing by removing the account and the keychain items and restarting the Macbook. I added the new account using OAuth/https and it created the keychain but I don't see any folder for SourceTree in the Application Support folder.


author: Timothy Wyant
body: I have the same problem. I have Sourcetree for years, with both local and remote repos. I followed the instructions above (Mac OS Mojave 10.14.2, Sourcetree 3.1.1)

I deleted the file \<username\>@STAuth-github.com is written at location \~/Library/Application Support/SourceTree/ before rebooting, but creating the new account in sourcetree did not create this file. It did create new keychain entries.

Trying to create a remote repository failed because of an "owners failure", then put me in sourcetree window I could not get out of without a force quit.

Restarting source tree puts me back where I was -- when I try to push to an existing remote repository, I get a repository not found error message, with a repository path that I believe should work.

I have not problem signing in to github on the internet, then everything looks fine. But I can't do any pushing or pulling from the corresponding local repos.


author: Manju
body: Can you try adding your Github account using ssh?


author: gpfister
body: Hi,

I have the same issue I think. I'm using SourceTree 3.2.1 on a Mac (latest version) and my github has 2FA. Each time I try to connect to my GitHub account, only a read-only access is proposed.

I have tried to remove GitHub with every tool, and also manually including preferences. I rebooted multiple times, cleaned the Keychain, but no matter what it only proposes read-only.

I have no such problem with other tools (Docker, GitKraken, ...).

Any idea ?


Tags: github

mac