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.comUsername 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