Sourcetree remote: Invalid username or password
Solution 1
I found the answer here, it is a known bug for version 2.1.8+
The following steps fixed it for me:
Tools > Options > Git > Update Embedded Git
Also pushing with the command line works.
EDIT
Also adding @Latisha's answer:
1. Do the above.
2. Close Sourcetree
3. Delete AppData\Local\Atlassian\SourceTree\passwd
4. Restart SourceTree
Solution 2
I struggled with this a lot, what solved it for me on my Mac is:
- Open finder, click Cmd + Shift + g
- enter
~/Library/
- Go to
Application Support/SourceTree
folder - delete userName@STAuth-bitbucket.org
- Open KeyChain Access
- search for sourctree
- delete the 'login' item
- clone your source from bitbucket
- KeyChain will ask for you bitbucket pass
Solution 3
I had the same problem for Sourcetree 2.10, but with the above solution not working.
Reverting to version 2.0 solved it.
Sourcetree download archive: (https://www.sourcetreeapp.com/download-archives)
Solution 4
I faced this issue when i updated Embedded Git
. Solved it by removing passwd file. you can find it here. then restart source tree.
AppData\Local\Atlassian\SourceTree\passwd
Solution 5
For OSX following by steps below
Go to: Preferences -> Advance -> Choose the account in table you want to remove -> Click to remove
Related videos on Youtube
Comments
-
Sven van den Boogaart about 2 years
Im trying to push to github with sourcetree but get the following error:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin live_version:live_version remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/myname/myrepo/' Pushing to https://github.com/myname/myrepo
Completed with errors, see above.
tools > authentication > my github account
And click edit > refresh oauth token A page opens and I get:
Authentication Successful
SourceTree has been successfully authenticated. You may now close this page.
It always worked but it suddenly stopped, i do not have two factor authentication. I tried deleting the account and adding it again to no avail. How can I get the connection working again so that I can push my project to github.
Sourcetree version 2.1.8.0
-
Zaporozhchenko Oleksandr over 4 yearsIt is 2019, version 4, still can't just normally switch accounts in Sourcetree to work with another GitHub account
-
-
NukeouT over 6 yearsYes! Reverting from 2.1 down to 2.0 SOLVES THIS! 2.1 will currently just keep telling you to change password and then flipping between two different errors as you change password and reauth every time. Probably wont be updating for a while after dealing with this bug for several days..
-
LaTisha over 6 yearsClose 1. Update the embedded git 2. Delete AppData\Local\Atlassian\SourceTree\passwd 3. Restart SourceTree
-
Roger over 6 yearsproblem still exists in 2.2.4.0?
-
Rasmus over 6 yearsproblem seems fixed in 2.3.1.0 if you update embedded Git (Tools/Git/Update Embedded Git) to Git version 2.14.1/LibGit2Sharp 0.24.0 + git-lfs v2.2.1 (I made no changes to AppData\Local files)
-
MarkoPaulo over 6 yearsI had the same issue with Git 2.6.2. This answer also fixed it. Now on git 2.13.2.
-
Goran Ch. over 6 yearsOn OSX
Sourcetree > Preferences > Git > Use System Git
. -
Patrick Knott over 6 yearsAll it took for me was the answer given, no need to delete a password, close, or restart.
-
Amit about 6 yearsThis is a pain, why SourceTree is not addressing this for Mac for so many versions.
-
Ville Niemi about 6 yearsThanks guys, saved me. Wish I had looked here before assuming I had just forgotten my github password and doing a reset. I needed to delete the passwd file btw. So it is sometimes required.
-
jjxtra about 6 yearsThat didn't work for me, but switching to system git did (on Windows)
-
silverbullettt about 6 years@LaTisha The step 2 works for me! SourceTree seems stupid to save the wrong password and won't allow me to update it, so I keep getting "Invalid username and password" error... until I delete it and retype the correct one.
-
FragmentalStew about 6 yearsI had the same issue with sourcetree 2.4.8 and git version 2.11 "Tools > Options > Git > Update Embedded Git" was all I needed to do. no extra steps required. Thanks!
-
roydukkey almost 6 yearsDidn't fix the issue for me.
-
clod986 over 5 yearsI had to follow @GoranCh. advice to switch to System GIT on PC; updating embedded GIT was enough untill last week
-
luky over 5 yearsthis helped thanks, and thanks to i realized what was the real problem - when the initial password dialog for bitbucket appeared i entered wrong password thinking it is a classical admin password for my mac. after your fix this dialog appread again and i entered correct password.
-
contactmatt over 5 yearsDeleting the app data solved it - was stacking up commits locally and couldn't push! Thanks!
-
Mordred over 5 yearsHad the issue where only one of my repos would get this error, but it worked from the command line. Deleting the passwd file fixed it.
-
peterc about 5 yearsDid both, after deleting the password file, it worked. Thanks
-
Alexander about 5 yearsWorked ... after entering username and password 7 times!! Thanks!
-
ajrwhite about 5 yearsThis is still a problem in 2019 with Sourcetree 2.7.6 for Mac.
-
bkurzius almost 5 yearsSimilarly - I deleted my Github account and added it back and the problem was solved.
-
Prabowo Murti over 4 yearsI pushed using the command line git, and it worked. Thank you.
-
Fangming about 4 yearsThis is still a problem in 2020 with Sourcetree 4.0.1 for Mac.
-
Mert Celik about 3 yearsThis is still a problem in 2021 with Sourcetree 4.02 for Mac.
-
Matej P about 3 yearsThis should be accepted answer for all mac users! The only thing that worked for me was this, after I switched from password to two-factor authentication.
-
Kate M almost 3 yearsThis is the only thing that worked for me after enabling two-factor auth
-
Alvaro almost 3 yearsWhat do you mean by "clone your source from bitbucket"?
-
CodeChari almost 3 years@GoranCh. Thanks, this should be the answer rather than a comment
-
Thomas VC over 2 yearsThis worked for me in 2021 with sourcetree version 4.1.3(239). thanks
-
pradeepradyumna over 2 yearsHands down to this trick. I followed the same exact steps and it worked!
-
SeanR about 2 yearsThis is still a problem in 2022 with Sourcetree 4.1.6 for Mac.