Hi
I have a git repo that I am accessing via SourceTree. I now need to access it via a Personal Access Token instead of via a password, due to changes that GitHub has implemented.
I have successfully generated a PAT, but I cannot figure out how to access my repo using my PAT from SourceTree.
I have searched google and stackoverflow and the sourcetree documentation and have not been able to find an answer that works for me. Perhaps I haven't found the right page, or perhaps my setup is in a weird state.
When I try to push to my repo, I currently get this —
git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/style4:refs/heads/style4
Pushing to https://github.com/justlikeUNIBLAB/whysaurus
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/justlikeUNIBLAB/whysaurus/': The requested URL returned error: 403
Completed with errors, see above
Thank you,
Josh
Community moderators have prevented the ability to post new answers.
I was looking for hours to find a guide until I found this:
you apparently have to write your username and authentication token in front of the repository URL as such:
https://<USERNAME>:<TOKEN>@<GIT_URL>.git
it feels weird to me putting the access token in clear text in this way, but neither using the PAT as password or using OAuth works. So please update me if you found a better way! ^^
but this way can't run for my case, could you give me an example for the URL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
instead of the usual "https://github.com/yourusername/yourrepository.git", you just put
"https://yourusername:yourtoken@github.com/yourusername/yourrepository.git" and you're good to go. Should be pretty much self-explanatory with the article on stackoverflow though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much! When I try this solution SourceTree throws a pop-up that gave me pause, pasted below. Is the message in this pop-up not actually a concern, or is there a better solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With SourceTree, I didn't find a different solution. If you're too concerned or in an open network, I would suggest to switch to the GitHub desktop app, which runs with an internal authentication.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.