SourceTree on Mac OS does not remember password

René Ruppert May 19, 2014

If I pull updates from a remote repo on Github I have to enter my password everytime (twice). In the SourceTree log output I find:

2014-05-20 09:06:09.581 git-credential-sourcetree[33632:507] Error (internetKeychainItemForServer:withUsername:path:port:protocol:) - The specified item could not be found in the keychain.

Is there a way I can SourceTree make remember my password? I do not see a checkbox or an option.

21 answers

1 accepted

6 votes
Answer accepted
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

Hey there,

Questions would be, are you using HTTPS or SSH? Did you add the auth details to your keychain when you authenticate? Did you correctly authenticate? That error (which generally shouldn't appear in later versions of SourceTree as I made improvements to it) is just trying to find the item in the keychain against the remote and username. You could always check your keychain, too.

Cheers

René Ruppert May 19, 2014

I am using HTTPS. The repo is setup like this:

https://username@dev.some-server.eu/stash/scm/client/mobile.git

How would I add the auth details to my keychain?

What can I check in the keychain? What would I look for?

I think what I did was: I had the repo already on my disk. I then added the existing repo to SourceTree.

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

Pictures speak a thousand words. Should only take you a minute, hopefully, then it's added there for good. I need to test this myself yet though, which I'll be doing this morning.

Like mitchellgarrett likes this
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2014

Just to clarify, other users are experiencing the same problem. My testing yields nothing because the particular case it happens in doesn't happen for everyone. The next version of SourceTree definitely has a fix for this.

Thanks for your feedback, it led me to the problem :)

Like sy0414 likes this
73 votes
Marnix Koerselman September 22, 2016

git config --global credential.helper osxkeychain

Josh Buchea January 30, 2017

This resolved all GitHub password issues for me in SourceTree. Thanks Marnix!

macOS 10.12.3, SourceTree 2.4, & GitHub 2FA

Like Yogendra Ghatpande likes this
pasnox February 14, 2017

Thanks, fix all my https issues as well!

This bug is still present in latest release...

Like Denys B likes this
Manuel Jasso March 5, 2017

This solved my problem as well, thanks!

 

Aleksy Goroszko April 5, 2017

It helped me too - all repos using https are working. It still asks for password when your remote url is using SSH but at least something works

Kenneth Luplau-Brøgger May 4, 2017

Helped me as well. Thanks Marnix!

Max Duncan May 24, 2017

This one worked for too, thanks!

barlieuy September 3, 2017

WORKED LIKE A CHARM. THANKS!!!

dieskim_skim September 21, 2017

Worked for me

wiwano October 16, 2017

Thank you! It worked!

Deleted user August 9, 2018

Excellent. Thank you. Still corrected my problem in 2018.

Alternatively, manually add these lines to each relevant git config:

[credential]
    helper = osxkeychain

Like DNReNTi likes this
Shuja Ud Din August 30, 2018

Thanks! This solved my issue

Polyák Sándor September 24, 2018

many many thanks!

cellepo October 31, 2018
Alessandro Moschitti February 16, 2019

genius!

Mark May 3, 2019

got it in one. strong work.

Mariano de la Riva July 2, 2019

You're my new god, thanks!

thefrosty July 9, 2019

Worked!

Peter Žilka October 1, 2019

Thanks, it works also on macOS Mojave 10.14.6

Pham Anh Duy October 15, 2019

Thank you very much! This works for me. After clone code successfully, I use terminal to run this code -> sourcetree password is saved.

sudhiryadav October 20, 2019

That worked for me too.

sudhiryadav October 20, 2019

On a second thought no it didn't. It appeared asking me the password again.

ronen March 19, 2020

wow

Thinh Hoang March 25, 2020

My problem is resolved.

Thanks Marnix!

Worked on macOS Catalina version 10.15.3, Sourcetree version 4.0

nongsonic July 16, 2020

wow

Muhammad Abu ul Fazal March 8, 2021

Thanks

12 votes
tejasjtym August 6, 2014

It has everything to do with keychain.

1.Go to applications and find keychain access in mac.

2. Search for the keychain for bitbucket.orgor wherever your repo resides

3. Select the keychain that has your credentials for bitbucket. Select to access control tab.

4. Click "+" mark and add sourceTree. This way, the SourceTree has access to the given key chain. Click on allow always when popup appears in SourceTree.

I had to do this when I wanted to clone a repo that used different set of credentials.

Valerio Santinelli August 6, 2014

This fixed the issue for me. Thanks!

Charles Barros September 17, 2014

Thanks a lot! That fixed the isse for me as well. :)

kmerhi October 7, 2015

This did the trick - thanks :)

rickgladwin April 11, 2016

This doesn't solve the issue in SourceTree 2.2.4 on Mac OS X El Capitan. I think there's still a bug in the new major version of SourceTree, since downgrading to the previous SourceTree version fixes the issue.

jaybowles May 13, 2016

Works! SourceTree Version 2.2.2, El Capitan 10.11.1

Thank you - was looking for a solution for weeks.

Henry Agnew August 26, 2016

This solved it for me - thank you!

muzammil_triffort September 1, 2016

Thank you! This solved the issue smile

Kevin Kirchner September 6, 2018

Thank you.

Kuldip Bhalodiya July 14, 2020

Thank you so much :) 

5 votes
Joe Hart October 26, 2015

Has anyone ever actually figured out how to get Sourcetree on Mac to start remembering passwords again? It's starting to get pretty old having to retype my password 100 times a day, but none of the solutions I've found posted online have worked so far.

Luke Salvoni November 2, 2015

Just started getting this today. Cleared out the 2 Bitbucket entries (1 from the web, 1 for sourcetree) in the keychain and restoring them doesn't change anything. Sourcetree still asks continually and then I get the same error message that @Wei Xia has posted.

Matt November 18, 2015

Experiencing the same issue the past two days as well. (been offline for a week, so unable to pinpoint when it started.)

3 votes
brettsinn November 3, 2014

Running into the same issue with most recent update to Yosemite (10.10) / Sourcetree (2.0.2). 

2 votes
vince-scarpa April 30, 2019

This worked for me

$ git config --global credential.helper osxkeychain
2 votes
Lee Probert January 4, 2017

I have a duplicate of this issue here: https://answers.atlassian.com/questions/43716302

Access your repository in the terminal and commit, pull, push etc. This fixed the keychain access issue in SourceTree afterwards.

rsigg December 11, 2017

This worked well for me... 
First had to enable Keychain storage of my passwords:
https://help.github.com/articles/caching-your-github-password-in-git/

2 votes
D August 9, 2014

I'm running SourceTree 1.9.7 on Mac OS 10.9. I was experiencing the same problem, and Tejas' fix above didn't work for me. The IP address of my Stash server changed recently, and I updated the IP address in 'Repository Settings'. Although this worked, I would be prompted twice for my password when attempting to pull or commit, and 'Refresh Remote Status' wasn't working properly. I then read a post elsewhere that suggested to select View --> Show Hosted Repositories, Edit Accounts --> Edit Account, and ensure that the IP address is updated there too. It contained the previous IP address value, and I updated it. Then, when trying to pull, an SSL certificate error appeared. The solution here is to hit the Stash server using Safari (it has to be Safari), and when the certificate warning appears, view the certificate, select 'Always Trust', and save. After that, all operations worked properly from SourceTree, and I am no longer prompted to enter my password.

It might be a good idea to delete any Keychain entries that are present for the Stash server before beginning the process above, just to make sure you're starting fresh.

2 votes
Omar July 16, 2014

Having the same issue: SourceTree (version 1.9.6) cannot remember my password in MacOS X (Maverick). Is this a SourceTree issue or Mac?

2 votes
Daniel Kopyc June 10, 2014

I'm seeing the same issue, still, on SourceTree Version 1.9.4 (1.9.4) and Mac OS X 10.9.3.

Seems to have "suddenly broken", either because of a SourceTree update or system update -- not sure which; but currently the product is unusable.

Tried clearing out any "bitbucket" keychain entries; that didn't help.

Also tried looking in "~/Library/Application Support/SourceTree" (per other posts), but there doesn't seem to be anything in there that's storing credentials, naturally.

Thoughts?

brianbarthold July 2, 2014

I am still having this issue on 1.9.4.1 has this been fixed yet?

1 vote
adamrackishotmail December 14, 2018

After much testing, it seems this is the only real solution, which works great for me

https://stackoverflow.com/a/35942890/352552

 

git config credential.helper store

then

git pull

provide user-name and password and those details will be remembered later.

adromil December 2, 2020

This definitely works for me

1 vote
tuckdesign February 19, 2016

This is still not working in SourceTree 2.1 and OSX El Capitan.

Noticed that sometimes when I try to pull from repository and then I click 'Always allow' for keychain question, bitbucket key in keychain gets deleted!

Even happened that SourceTree won't start. Then I had to manually add key in keychain for bitbucket.

Tried to allow all aplications to access that key, but doesn't help because SourceTree deletes key and writes it again!

1 vote
Wei Xia November 28, 2014

屏幕快照 2014-11-29 13.40.07.pngWhere I can config keychain? I am using OSX10.10 and sourceTree 2.0.3, and I can not push changes to server.

0 votes
Files Villa November 25, 2021

In Mac, it can be changed by clicking on Gear icon > Accounts. Alternatively, you can go to the "Keychain Access" utility on the Mac, search for the remote password and delete the stored key. Then the next time you start SourceTree, it will ask you for your new credentials. Let us know if this worked for you! By using Niresh Mac OS X Yosemite

0 votes
eric franchomme March 19, 2019

nothing worked for me. I removed all accounts from SourceTree, generated new SSH Keys, by following these instructions:

 

https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html

0 votes
Savita Chauhan August 3, 2018

I hope my answer helps others because I had been struggling with password issues with SourceTree for quite a while and finally figured out the issue. I have SourceTree (2.7.6) on Mac (Sierra 10.12.6) and repo is on TFS. 

I had changed my network/Mac password, that also meant that my tfs repo password was changed too. But this password didn't change on my Keychain Access credentials for tfs. So, I went to Keychain Access and looked for 'tfs' (found two entries). One of them still had my old password. I changed that to my new password and added SourceTree in the AccessControl tab (by clicking '+' at the bottom). Everything works like a charm now :).

Fingres-crossed. 

0 votes
WayneJohnson October 9, 2017

Finally! Solved this for myself after DAYS of trying every single thing in every possible thread - thanks everyone for providing enough clues for me to get to the bottom of my issue...

So, for me, it seemed to be ONLY my username that was causing the trouble.

In Sourcetree - Preferences - Advanced...

Have a look at what your username is. I had four entries https:gitlab, myusername@gitlab etc, but all the usernames appeared to be my 'display name' at gitlab rather that a 'real' username. So I went to Gitlab to see what it thought my actual username was, and it was actually my full email address, including @ and .com - once I had changed this in preferences\advanced on the https:// account and deleted the rest, I haven't been asked for a password since and all seems right with the world! Best of luck, everyone.

Roberta Roebuck November 9, 2017

I have been banging my head against this for just one repo for a while. This worked! Thanks so much!

WayneJohnson November 9, 2017

Nice one! Never thought I'd be useful on any git-hub-lab-repository thing, whatever they are! Cheers ;]

0 votes
bauerdev May 29, 2017

Was happening all the time on macOS 10.12.5, SourceTree 2.5.2.

Had to go to Keychain Access, remove all (SourceTree) entries (if you search for SourceTree, you'll find "<reopSite> Access Key for <username>").

Thay dated a few months back.

After that, open SourceTree > Preferences > Accounts > Edit (for each account), and enter the passwords again.

It should prompt the Keychain Access popup again, and this time, you should see new entries created. 

0 votes
Deleted user January 3, 2017

If you guys have two factor authentication on in github you have to create a token for SourceTree and use it as a password.

0 votes
Matthew Pantaleone August 19, 2016

I had this same problem recently. My company migrated from Stash to Bitbucket, so the keychain was storing it as Bitbucket but my repository was pointing at matt@stash. Once I updated the repository settings it started working.

Steps were to go to "Repository" | "Repository Settings" | "Remotes" and edit the path their to say "https://matt@bitbucket.com..." 

0 votes
zhuhuiping June 20, 2016

go to set you General ,chose NetWork change you Username for you Host(github.com).

zhuhuiping June 20, 2016

I also encountered such a problem, the last is such a solution

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events