Sourcetree remote: Invalid username or password

113,039

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 enter image description here

Share:
113,039

Related videos on Youtube

Sven van den Boogaart
Author by

Sven van den Boogaart

Software developer

Updated on March 17, 2022

Comments

  • Sven van den Boogaart
    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.

    enter image description here However when I go to

    tools > authentication > my github account

    And click edit > refresh oauth token enter image description here 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
      Zaporozhchenko Oleksandr over 4 years
      It is 2019, version 4, still can't just normally switch accounts in Sourcetree to work with another GitHub account
  • NukeouT
    NukeouT over 6 years
    Yes! 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
    LaTisha over 6 years
    Close 1. Update the embedded git 2. Delete AppData\Local\Atlassian\SourceTree\passwd 3. Restart SourceTree
  • Roger
    Roger over 6 years
    problem still exists in 2.2.4.0?
  • Rasmus
    Rasmus over 6 years
    problem 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
    MarkoPaulo over 6 years
    I had the same issue with Git 2.6.2. This answer also fixed it. Now on git 2.13.2.
  • Goran Ch.
    Goran Ch. over 6 years
    On OSX Sourcetree > Preferences > Git > Use System Git.
  • Patrick Knott
    Patrick Knott over 6 years
    All it took for me was the answer given, no need to delete a password, close, or restart.
  • Amit
    Amit about 6 years
    This is a pain, why SourceTree is not addressing this for Mac for so many versions.
  • Ville Niemi
    Ville Niemi about 6 years
    Thanks 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
    jjxtra about 6 years
    That didn't work for me, but switching to system git did (on Windows)
  • silverbullettt
    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
    FragmentalStew about 6 years
    I 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
    roydukkey almost 6 years
    Didn't fix the issue for me.
  • clod986
    clod986 over 5 years
    I had to follow @GoranCh. advice to switch to System GIT on PC; updating embedded GIT was enough untill last week
  • luky
    luky over 5 years
    this 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
    contactmatt over 5 years
    Deleting the app data solved it - was stacking up commits locally and couldn't push! Thanks!
  • Mordred
    Mordred over 5 years
    Had 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
    peterc about 5 years
    Did both, after deleting the password file, it worked. Thanks
  • Alexander
    Alexander about 5 years
    Worked ... after entering username and password 7 times!! Thanks!
  • ajrwhite
    ajrwhite about 5 years
    This is still a problem in 2019 with Sourcetree 2.7.6 for Mac.
  • bkurzius
    bkurzius almost 5 years
    Similarly - I deleted my Github account and added it back and the problem was solved.
  • Prabowo Murti
    Prabowo Murti over 4 years
    I pushed using the command line git, and it worked. Thank you.
  • Fangming
    Fangming about 4 years
    This is still a problem in 2020 with Sourcetree 4.0.1 for Mac.
  • Mert Celik
    Mert Celik about 3 years
    This is still a problem in 2021 with Sourcetree 4.02 for Mac.
  • Matej P
    Matej P about 3 years
    This 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
    Kate M almost 3 years
    This is the only thing that worked for me after enabling two-factor auth
  • Alvaro
    Alvaro almost 3 years
    What do you mean by "clone your source from bitbucket"?
  • CodeChari
    CodeChari almost 3 years
    @GoranCh. Thanks, this should be the answer rather than a comment
  • Thomas VC
    Thomas VC over 2 years
    This worked for me in 2021 with sourcetree version 4.1.3(239). thanks
  • pradeepradyumna
    pradeepradyumna over 2 years
    Hands down to this trick. I followed the same exact steps and it worked!
  • SeanR
    SeanR about 2 years
    This is still a problem in 2022 with Sourcetree 4.1.6 for Mac.