How to update HTTP(S) credentials in sourcetree
Asked by Josh Love:

I'm using Stash, Sourcetree and Crowd. Crowd authenticates with our AD server. One of our users' AD passwords expired today and he went to do some work via sourcetree and it wouldn't let him communicate with stash properly

He set up the repo initially as HTTP when he first cloned it. It asked him for his username and password and he says he remembers clicking "Save/remember password"

Where can I have him reset/remove these credentials.

I've already worked around the issue by setting up SSH keys for this user, but I'm interested in what the fix would be. Presumably something via the command line, as I've been through every GUI screen I would think could have the setting in it.


Answers:
author: David Keck
body: The only thing that worked for me was navigating to C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree and removing the passwd file.

Once this file is removed, restart SourceTree and execute a fetch or something else that requires access to the repo in question. SourceTree will then prompt you for your password, rewriting the cached credentials.

I hope this helps. Shoutout to my buddy Nick for the assist.

If you're a macOS user, Auke states below that "you can find the password files per repo it in \~/Library/Application Support/SourceTree"

comments: author: Rajesh
body: This saved my time. Thanks!


author: Josh Hed
body: This worked great. I've been digging into this for over an hour! Thanks.


author: Rob Baragona
body: This is also the only thing that worked for me. Josh is lucky, i've spent about 5 hours on this between 2 different computer and creating new passwords!

THANK YOU!!


author: christopher_cook
body: This worked for me as well.


author: Joseph Testa
body: worked, thank you!!


author: Someone Unknown
body: Only this solved "Authentication failed for" error for me. Thanks!


author: Ben Salvage
body: Saved me too. Thank you!


author: Auke
body: Alternatively, if you're a mac user, you can find the password files per repo it in \~/Library/Application Support/SourceTree


author: jonghyun,yi
body: Auke ter Horst You saved me! Thank you so much! I'm also mac user.


author: adanzilla
body: Thank you David!!!


author: Silvio Di Silvestro
body: It worked for me. Thx a lot !


author: Dan Ames
body: Thanks David Keck! This saved me much pain and agony.


author: Christophe Racine
body: Cool, worked for me, thanks a lot !


author: HilcoVM
body: Only way I could get access to my remote repo again. Thanks heaps!!


author: Loc_rabbirt
body: Thank you so much, it's helped :).


author: Joe Wright
body: This worked! Thank you very much.


author: jingjing
body: Thank you so much! That's the only thing works for me. I have been spending too long on this.


author: jingjing
body: Thank you so much! That's working!


author: Sebastian Raemsch
body: This worked for me too! Thanks.


author: VenomBHz
body: This was the solution!!! Spent some time trying to fix this... Thanks!!!


author: David Keck
body: I'm so happy to see that this helped! Auke, I'll update the main answer with your macOS findings.


author: Sergiu Jardan
body: Thank you. This worked for me.


author: Mauricio Salazar
body: This was the answer for me to delete the C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\passwd file, however, I also needed to change the username, and there was no way to do this through the sourcetree interface.

I found a file C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\userhosts which had the wrong username. I changed it there and restarted and then it was able to push github repos to the correct username.


author: David Teo
body: thanks David. your solution worked for Authenticate error.

fyi:

1) the failure ocurred on my SourceTree v2.3.x.x, when I updated my network Windows password.  
2) When I ran ST v2.0.20.1 executable, no authentication error was encountered.  
3) When I re-ran v2.3.x.x again, the authentication error resurfaced again.  
4) Then, I came upon your solution and tried it, v2.3.x.x is working fine now. The original password file was dated ard 2 months ago, likely the last time it was changed before i upgraded to v2.3.x.x?

5) Before all these, i also tried the Tools-\> Options -\> Password change method.  
It says authenticated after giving the correct password, but when I fetched my Repo, the authentication will fail. So apparently the passwd file in (4) could not be updated, which caused repo actions to fail?

Maybe it's a version bug?


author: Konstantin Pogorelov
body: Yep! That is the solution. Thank you very much David!


author: Zorobabel
body: Thanks, this is the right solution


author: Lia Gelder
body: Thanks David! This worked perfectly, only wish I had found your answer sooner!


author: Otto Harju
body: Works for me. Credentials are not visible anywhere on the UI, not on the Tools-\>Options-\>Authentication tab, repository settings or Windows Credential Manager. Is there a JIRA ticket about this issue?


author: Shreya Rawal
body: This worked!! :)


author: Horacio Filet
body: Nice, it worked, thank you!!


author: kairaca
body: Finally. Thank you!


author: Philip Chan
body: This worked for me with version 2.4.7.0


author: Tracey Gibbons
body: Thank you, and thanks to Mauricio Salazar for the userhosts info!


author: James Attwood
body: Thank you so much! This worked for me with version 2.4.8.0 Windows 7 64bit


author: ronpackard
body: Worked for me on the Mac.


author: Antonio Sobalvarro
body: Works perfect.


author: David Hubbard
body: Thanks - this also worked for me - however as it's a central file - if you are using other accounts through SourceTree (e.g. BitBucket, GitHub) then you may want to just remove a single account line from the file rather than deleting the whole file.

Plus, as the User account used by SourceTree is also referenced in answers here - To specify a specific user account (which is not the default) I found that setting userid in the repo path (Settings \> Remotes \> Edit) e.g. http://**myRepoUser@**myrepo:3000/organisation/myrepo.git worked for an internal git server.


author: Karl Zuvela
body: This worked for me only after changing my Windows password again, as Sourcetree does not seem to accept passwords that begin with a special character such as '-'. Once I changed my password to begin with a letter then everything functioned as expected.


author: isac joseph
body: THanks maan..


author: Olga Farber
body: thank you so much! only this helped me, too


author: abnersouza
body: Not working for tried many times to login to git in vsonline it was working just fine, but removed the keys from keychain, also reinstall and tried to clean up everything, when i type the credential it does not work and show the following on my mac:

fatal: Authentication failed for;

Even the credentials are correct


author: Manny Yu
body: Works for me. Thanks much!


author: Krzysztof Ga??zka
body: Worked like a charm! Thank you!


author: Thyago Akira De Morais
body: Great. Worked for me too. Thanks


author: Robert Pal
body: Worked! Thanks!


author: oanselmogomes
body: Funcionou pra mim! Obrigado! Thanks from Brazil!


author: lokt-par
body: This worked for me. Thanks


author: nick
body: also worked for me


author: ccino
body: Thank you, David. This worked for me.


author: Andrea Franchini
body: Worked also for me.  
Close Sourcetree, delete the password file, open Sourcetree, random fetch =\> correct login.


author: Pumpkins_
body: Worked for me, lost about 1 day of my life trying to fix it.


author: jessicafreeney
body: Was trying to fix this for about a week and this fixed it


author: Dean
body: Saved my life. Thanks man!!!


author: Anssi
body: This solved my problem. Thanks.


author: Ruben FitzSimons
body: Many Thanks! Worked a treat!


author: Levin Purba
body: Almost the end of 2018 and this problem still persist. Deleting the passwd file was the only way to get around.


author: rc_kamran
body: Thanks alot !


author: Alon Katz
body: Thanks!


author: Uma Vijayakanthan
body: Yup did the trick, the problem started when i changed my Atlassian password, after few days i opened source tree and i couldn't login with new password, it kept asking for password over and over again.

Once removed the passwd file then it all worked! They should address this on the SoruceTree app.

Thanks

Uma


author: gargall82@gmail.com
body: Thanks boy you are a great boy.


author: Pravin Bhat
body: This helped me save time, thanks David!

Atlassian should fix this annoying issue.


author: Bandula Prasanna
body: This really helped me getting resolved the same issue that wasted my time troubleshooting.

Thank you very much!


author: khorshed_alam
body: Million Thanks! You are rock!!


author: Pablo Silvarrey
body: Aleluya!


author: Jaque Nande
body: Thank you so much :D


author: apttus_neshah
body: thanks it worked like charm


author: Vlad
body: **Thanks so much**


author: MrDEV0
body: It works for me, thank you so much.


author: G?za KISS
body: There is now a menu item for it (see answer below): Tools \> Options \> Authentication


author: Chris D
body: This half-solved my problem after upgrading to the latest version on Windows (3.3.8). I actually deleted all SourceTree folders under AppData just to be sure. Then I revoked my OAuth access to SourceTree from my Bitbucket account (through the website). Still wasn't working. I couldn't get past the "Registration" screen during installation that connects to BitBucket. It just stays on that screen after logging in and nothing happens.

Finally, I downgraded to 3.2.6 (what I had previously) and poof, everything was working again. I had to revoke/refresh my OAuth but at least I could open and work in SourceTree again.


author: nurulamin
body: Thanks - it worked for me too


author: ALEXANDROS KESANOPOULOS
body: It also worked for me.

If I change the password through UI it works for some hours and then it fails again probably because the passwd file is not updated.

Why does sourcetree uses credentials from two sources(windows credentials and passwd file)?


author: gs_luismoreno
body: Worked for me. Impressive that this is still an issue after years, using Sourcetree version 3.34.


author: BartmanDilaw
body: This save my day !


author: Koen Lesschen
body: I can't believe that Sourcetree still did not fix this bug.


author: Sebasti?n Salguero
body: Great!


author: Jeffrey Gillingham
body: Thanks for this, it fixed my issue and saved me lots of time.


author: Reema Dass
body: Thankyou soo much this had worked for me and has saved a lot of time :-)


author: Nicholas Hibshman
body: Worked for me too!


author: Robert B
body: almost 2021 and it is still the best option. thanks!


author: ALEXANDROS KESANOPOULOS
body: Don't expect any good in 2020!


author: Roque BUGARIN
body: Great !!! Thank you very much !!!


author: Genesis Tabuena
body: Best solution out there, definitely saved time!


author: Maxi Ramos
body: Perfect! The SOLUTION


author: Rich Newman
body: I had a similar problem on Windows 10 when I wanted to use a new account on GitHub. SourceTree was using cached credentials, and not displaying them on its internal dialogs, and I struggled to find a way to clear them. I only worked out what was going on when I tried from Git Bash and had the same problem. The credentials were definitely NOT on Tools -\> Options -\> Authentication.

The reason is SourceTree uses the Windows Credentials Store, so rather surprisingly you have to go to Control Panel. Then Users and Accounts/Manage Your Credentials/Windows Credentials (it defaults to Web Credentials, which isn't what you want). I had an entry for github.com under 'Generic Credentials'.

I deleted this from the credentials screen and then tried to push from SourceTree, which now asked me for the new credentials and performed the push using them.

I don't know how easy Microsoft have made it for third-parties to at least show these credentials on their screens, but I would think this would be a reasonable enhancement for SourceTree to make.

comments: author: HenrikS
body: Same procedure should be followed on Windows 7 if just trying to change the password through Sourctree options fails.


author: Maksim Borisov
body: Worked! thanks


author: Breno Santos
body: Thx man, solve my problem.


author: Sudhanshu Dixit - HAM
body: Thank you Rich, it worked for me, i was look at all the places for a solution. I had even removed the credentials from Web Credentials page. I saw there were 3 different credentials for git which when removed worked for me.


author: Holly_Yelland
body: This worked for me, thanks!


author: Ancher Vijayakumar
body: This worked for me, Thank you


author: Ancher Vijayakumar
body: ![Untitled.png](https://community.atlassian.com/t5/image/serverpage/image-id/74216i9A928437A5519A45/image-size/large?v=v2&px=999 "Untitled.png")Deleted these two lines and it worked.


author: Helen
body: This is what I needed, thank you!

So frustrating though, trying to figure this out. I'd really like to see a wiki page about this...


author: gneocl
body: This was really helpful! I spent a lot of time on this and you saved me even more, thank you!


author: Oppenlander
body: Just had this happen to me too. I'm suspecting the root cause of this is when the Atlassian migration occurred from using login names to e-mail addresses. These can be used interchangeably on Atlassian, but is probably not accounted for in Sourcetree? I had two password files stored, associated with a username and an e-mail. Sourcetree was probably looking at the wrong one, and there's no transparency in the Sourcetree UI.


author: Tracy Lea Ogden
body: 2021 And this was the only thing that worked for me. Thanks for this!


author: stevestreeting
body: If this is Windows, you do this in Tools \> Options \> Authentication, you can delete or update any passwords there.

On the Mac, you can do the same by starting Keychain Access and locating the password entries there.

comments: author: Douglas Kazumi
body: I had exactly the same issue on a Mac and could solve it using this answer.


author: sagan9
body: Had same issue on my mac, and solved it by changing credentials on Keychain Access. Thanks!


author: Breno Santos
body: Thx man, solve my problem.


author: Frank Frank
body: This doesn't work for me. When you hit delete, it will not do anything. When you hit edit, it will create a new entry with wrong information.


author: behelit
body: This STILL doesn't work, even in the latest builds. Authentication says all good but when you pull/push you get authentication failure. It obviously stores the repo pass in some convoluted system that doesn't work.


author: Alexander Manoharan
body: Thanks, it worked for me


author: Brett Shellhammer
body: Thank you ... this worked great !!


author: Olga Farber
body: Doesn't work in Windows, all says "authentication ok", but then pull gives again authentication error. Only thing that helped was to go and delete that file


author: Ian Kleinfeld
body: This worked great for me -- I just deleted my password, then it asked for it next time I accessed the remote and all was good.  

When I just "edited" it, it didn't work.


author: Jo?o Martinho Marques
body: Thanks man! It worked for me


author: Allyn
body: This worked for me, thanks!


author: lme
body: Thanks a lot !


author: Daniel Brinca
body: On SourceTree 2.7.6 you can easily reset your repo credentials, without having to mess manually with files, by following these steps:

1. Open SourceTree preferences
2. Go to the Advanced tab, to the far right
3. Find the host name of your repo under "Default usernames for URLs which do not include one", on the bottom
4. Press Edit, clear the username (leave it blank), and press OK
5. Close preferences, do a Fetch on your repo, and enter the new credentials when prompted

comments: author: Keri-Lyn Crovo
body: I had to remove all the account information in here, have it prompt me for username/password (tried to clone empty repo from BBS in SourceTree), then I was able to connect enough to clone. What a pain!


author: Elizabeth Brealey
body: This solved my problem! Thank you!


author: Alvis Or
body: Solved it for me on Mac. Thanks!


author: sangbpark94
body: This is the real solution!!!


author: Ruedi Heimlicher
body: Mac user: In High Sierra I found the Auth file in

\~/Library/Application Support/SourceTree

File: \<username\>@STAuth-github.com

I removed this file, restarted SourcTree and was prompted for the password in the push process.

comments: author: Eddy Zhang
body: **Update DATE:** **Dec/13/2019**   

**Recently I received an email from github:**
> You recently used a password to access an endpoint through the GitHub API. We will deprecate basic authentication using password to this endpoint soon. We recommend using a personal access token (PAT) with the appropriate scope to access this endpoint instead. Visit: <https://github.com/settings/tokens>

**This works for me. Thanks!**


author: Saad_ZARHLOUL
body: HI all,

If after deleting the password file, authentication credentiels ...

still dosen't work, try to use terminal from sourcetree and do a fetch you'll have a window asking to enter your credentiels. and it will be working fine :)


author: vishprak
body: Simply worked. Thanks


author: John McDougall
body: That worked. Thanks very much :-)


author: niksman85
body: In search bar type Credential manager - Windows credentials - find and modify password.

It worked for me.


author: leeanne99
body: It didn't work for me however I changed the 'Auth Type' in the Accounts to Basic and then manually added my new password. :)![Screenshot 2020-06-11 at 16.25.18.png](https://community.atlassian.com/t5/image/serverpage/image-id/98606iB804916A823138D5/image-size/large?v=v2&px=999 "Screenshot 2020-06-11 at 16.25.18.png")


author: hithakshi_kulal
body: Yup.. That worked!!! Thank you.

Deleting ***git@STAuth-github.com*** file did the trick.


author: hkmoca
body: If you're a macOS user, Auke states below that "you can find the password files per repo it in \~/Library/Application Support/SourceTree"

Also, if you have issues changing the user name, in mac delete:

hostusernamemap file


author: K_Ravi_Kumar
body: In my case I had multiple copies of Keys along with the updated one. I resolved by removing the old credentials from Keychain .


author: duncan chiriga
body: This worked for me (Sourcetree v3.2xx on Windows 10):

Problem: Failure to Authenticate:

Reason (why probably): because initial registration was done using Google Auth APIs, therefore...

1. Click "Remote Tab \> Edit Accounts

2. Click on your saved bitbucket account

3. Click "Edit" again

..under "Credentials"

4. click "Authentication" and select "OAuth"

refresh and you should be set ..hopefully


author: Siti Farah Ismail
body: Maybe u guys can give this a try:

1. Goto Tools \> Options

2. Click Authentication tab. There's sections(for me Accounts and Git Saved Passwords) for previously saved passwords.

3. Just click on the desired account. Details for the account will be shown with Edit and Delete buttons

4. Click Edit. It will prompt a window for you to put your password.

Done!


author: Peng Huang
body: Thank you David!!!


author: Jeff Szczypinski
body: I had to go to the C:\\Users\\\<user\>\\AppData\\Local\\Atlassian\\SourceTree directory and delete the cache folder and the passwd and userhosts files. Restart Source Tree, do a pull and it prompted me for the ID and PW.


author: Xolela Masebeni
body: You can also simply add your username in front of you repository address: e.g: git clone https://**xolela@**bitbucket.masebeni.co.za/scm/project_x.git

You will then be prompted to put in your new password on your next pull or push. From there you will not be prompted for a password until you change it again.

comments: author: Laurence Henderson
body: Can anyone tell me what the password filename is


author: David Hubbard
body: As per the accepted answer (assuming you are on Windows) C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\passwd


author: krembo99
body: [@Xolela Masebeni](/t5/user/viewprofilepage/user-id/2756601) this might work for a single repository but not for the hosted repositories dialog


author: arich
body: You don't have to blow away your whole password store.

In SourceTree navigate to the repository in question, click the Terminal button and type \`git pull\`. It will prompt you for the required credentials then you're good-to-go in the GUI as well.

comments: author: Jeff Szczypinski
body: That didn't work for me.


author: Dean
body: Just use **Git Desktop**. Tired of this bloody popup authentication modal!!!!!!!!!!!!!!!!!!!

comments: author: Dan Ames
body: I agree completely. I've recently switched to Git Desktop and love the simplicity and ease of it.


author: WEBCODER LTD (EU)
body: Mac OSX 13.3.3, deleting password files doens't work for SourceTree 3.0.1 when trying to connect to Atlassian Bitbucket v5.11.1 self-hosted server. I managed to connect to Cloud BB and was only then able to get into the app's options otherwise it's completely useless. I still am unable to use it with the above BB server we're hosting so another broken cr\*p from Atlassian.


author: Reyelle Matanguihan
body: This didn't worked for me. There is no password file under C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\

This is always what I get:

![error.png](https://community.atlassian.com/t5/image/serverpage/image-id/26637i0D8E508876372C54/image-size/large?v=v2&px=999 "error.png")

comments: author: lauxjpn
body: Try my suggestion here:

<https://community.atlassian.com/t5/Sourcetree-questions/Re-Git-Credential-Manager-for-Windows-Popups/qaq-p/923736/comment-id/25327#M25327>


author: Bias Corp
body: hanks guys. It was helpful


author: armchairdeity
body: Just for the sake of having complete use cases here... I had **what I thought** was the same problem. Turned out that our auth scheme had changed and we started logging in with just the username portion of our email addresses... so ++jrypkahauer++ instead of ++jrypkahauer@gmail.com++. The real problem came when I added "jrypkahauer@gmail.com" to the list of default usernames for our domain.

So effectively I had inadvertently made it impossible for myself to use the correct username on the domain where our git repositories all live.

It took me nearly 4 months of fighting this to figure out why ONLY SourceTree forced me to use an old, invalid username but would still prompt for the password if it was provided. Today I went panel by panel thru the entire Preferences UI and finally found this one.


author: Alexandru Puiu
body: The credentials for windows are managed in the Windows Credential Manager in the Control Panel.

comments: author: Keri-Lyn Crovo
body: Unless Git-Credential Manager is installed and ruins everything!


author: Ersi Ni
body: Respectfully I must disagree with Steve's answer: It doesn't work at least for me because in Authentication there's no saved credentials for bitbucket.org and stash. I updated all my credentials for bitbucket and other vendors on the web, later i have to find out that i cannot log in to bitbucket in sourcetree, and there's no way for me to clear saved credentials. Except maybe wipe the local storage where sourcetree saves the preferences etc. but that can't the solution.

Edit: environment is windows.