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

Sourcetree can no longer access github.com

Marc S January 14, 2023

In october 2022, I created a GitHub personal access token (classic) for Sourcetree, and saved it in the macOS keychain. Expiring date october 2023.

I uploaded my SSH and GPG keys to GitHub.
I set: "git config --global credential.helper osxkeychain"
In Sourcetree settings, I pasted the access token in the password field of my GitHub account.
Then I was able to use SourceTree 4.2 to push changes to my GitHub projects.
Life was good…
Shortly before christmas, this stopped working. When I tried to pull from a forked repo from github, Sourcetree kept asking me:
      Password Required for user git on host github.com
No matter what I entered, nothing worked and it kept showing that same dialog again and again.
Today I deleted the personal access token from github.com and made a new one.
Deleted all GitHub password items from my keychain.
Re-entered "git config --global credential.helper osxkeychain" in the terminal.
Now when I launch Sourcetree, I get a dialog: Authenticate, Login required for: https://github.com
Username is correct pre-filled for my github account, Password field is empty.
I paste in the new access token, and check “Save password to keychain”.
However, when I look into my keychain, there’s no new entry for Sourcetree or GitHub.
So I open Sourcetree settings -> Accounts, there’s my GitHub account (Basic, SSH).
But the password field was empty. I pasted the new access token, hit Save and again the Authenticate dialog popped up.
I pasted the token again.
Now I see a new "github.com Access Key” application password in my keychain.
But it doesn’t work. I still get the "Password required" dialog in Sourcetree.
I have another access key for Sourcetree for a GNU server which I also made in october 2022. This still works, I can push&pull to the GNU project without problems.
I compared the config files of the (working) GNU and GitHub repos. Under [remote "origin"], the GNU url started with git+ssh://git@xxxxx, but the GitHub url = git@github.com:my-account/my-repo.git
I added "git+ssh://" like the GNU entry, saved, but after I quit and relaunched Sourcetree, the GitHub config file was reverted to git@github.com without the "git+ssh://" prefix.
What else can I do to make the new access token work?
Marc

1 answer

1 accepted

1 vote
Answer accepted
Marc S January 14, 2023

I deleted my local repo and used GitHub Desktop for Mac to clone it from remote.

After that, Sourcetree can access the github remote again and doesn't show that dreaded "Password Required" dialog. I didn't even need to re-new the entry in Sourcetree's list of repos because I cloned it to the same local location.

Yay. It works again...

Marc S January 14, 2023

I was curious what the reasons were. So I compared the new local folder with the old one (which I of course didn't delete but only rename).

In the new config file, the remote url was https://github.com and not git@git.github.com.

So I tried to change my config file of another no-longer-working repo to https:// also. But it still didn't work, so there must be more changes in the .git subfolder than just the config file. I gave up and just cloned this repo also again with GitHub Desktop and that new clone also worked in Sourcetree.

michealpeters January 16, 2023

I was reading this due to a very similar problem.  GitHub Desktop was using HTTPS instead of SSH which is why it was working.  I still can not connect via SSH with any of my repos, but am able to connect via HTTPS.

Like nick_radonic likes this
nick_radonic
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!
August 11, 2024

1 year later....yeah I had workarounds for a while - had to switch to HTTPS

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events