Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SourceTree does not retrieve user name and password from keychain

Fergus Gibson February 7, 2012

SourceTree asks me to provide the my User Name and Password each time I try to communicate with my hosted repository even though "Save password in your keychain" is checked.

I can delete the keychain entry, and SourceTree will recreate. SourceTree still won't use it though. Behaviour is reproducible.

OS: OS X 10.7.3
SourceTree Version: 1.3.1.1
Repository Host: Kiln
Keychain: Login
Keychain Status: Unlocked

Keychain Entry Access Control:

  • "Confirm before allowing access"
  • Always allow access by these applications: SourceTree

5 answers

1 accepted

7 votes
Answer accepted
John Denton May 14, 2014

Just to offer a potential solution from an extremely non-tech angle. I'd been wrestling with this for days. I ended up with no keychain record for 'bitbucket.org' at all and SourceTree was prompting login all the time. It did seem to coincide with an OSX update.

The solution (for me) was simply in SourceTree to press "Cmd Shift H" This opens a username / password prompt into which I entered my bitbucket details. Saved and then BOOM - keychain added and SourceTree behaving itself again.

For the record I'm on SourceTree Version 1.9.2 (1.9.2) and OSX Version 10.9.2 (Mavericks)

Brian LeBaron May 21, 2014

This fixed the issue for me.

Chip Allen May 27, 2014

Worked for me as well. Problem was also after an OSX update.

brettsinn November 4, 2014

I just upgraded to Yosemite and had a similar issue. I first had to remove the existing password in the keychain, then proceed using the steps mentioned. Thanks John!

Liran Harary July 20, 2017

This is the only solution that worked for me (after trying several solutions from different sources). Thank you!

2 votes
stevestreeting
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.
February 7, 2012

Problems like this are usually caused by some kind of ambiguity when trying to resolve the keychain entry. Please can you check the URL you're using and make sure you include the username in it, ie https://username@host.com/path/to/repo - the username is mandatory when looking up keychain items and although SourceTree tries to compensate for that by remembering a default from your first use of the domain, if there are other uses of the domain that doesn't always work. Specifying the username in the URL makes it explicit and means it doesn't have to ask.

Fergus Gibson February 7, 2012

Thank you for your response, Steve. You have resolved my issue.

I do think this is less than obvious (i.e. that the Username set for an account through Hosted Repositories is not useful for authenticating for push/pull operations with a host). This is one area that it might be possible to improve the UI and behaviour.

Thanks for the great app, and the support! I originally bought SourceTree from you before it was acquired by Atlassian, and I'm glad you're still involved with it.

stevestreeting
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.
February 7, 2012

Yes, the standard Kiln URLs don't include the username unfortunatley; usually the 'defaulting' gets around this but depending on the domain used it's possible it can get ambiguous and SourceTree only tries one default. I could probably improve this by being smarter about picking the default username when it's not explicit, I'll give that some thought.

Thanks for being a long-time supporter of SourceTree, indeed I'm still here, trying to make it better all the time :)

Jared Christensen February 6, 2014

I'm using stash and having the same problem. I did not undertand where I need to change the url from the answer above. Can you give more details.

0 votes
nafonsopt June 1, 2012

This is a real problem. It is _the_ thing that so far breaks SourceTree.

Why simply not build the URL for us? I.e. have a URL field, have a username field, and in the background create a full URL with username and use that? Especially given that some usernames have @ in them (e.g. Kiln usernames), in which the user has to input @ escaped (i.e. %40 instead of @), it is just too bothersome.

ATM this is just confusing, and makes the product feel sloppy. Please fix this in future versions.

stevestreeting
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.
June 3, 2012

Thanks for the feedback. Most of the time you don't actually need the username in there (it's on if there's ambiguity, such as when there's 2 entries for the same domain), and Kiln is the only system which uses full emails as the username and so requires the %40 escaping - every other host does not, so does not have this problem. The reason that the URL is presented simply as a single field is to allow any kind of URL to be used (there are many variations in type and structure), and for it to be a simple copy/paste in the majority of cases. Having a 'builder' would actually be slower for the majority of cases. Still, perhaps we can add it as an option in future.

nafonsopt June 3, 2012

If that is only a Kiln case, and you "support kiln" by default, then have a special case just for Kiln.

ATM, every time I install in a new machine, I have this problem and then I have to remember this all over, it is boring and annoying, it is the software working against me.

I'm pretty sure that when I ran it for the first time now, it even asked me for "current accounts", and Kiln was one of the options. I input all the info, and then I didn't have any repositories, like that step didn't do anything (not sure if it is because of the username mess).

Like there are little details that "annoy" like the Atlassian link on the main window (imo, if you wanted to have a link it should only be on the SourceTree app menu, which it already has btw, having it there in your face doesn't add anything), but this is something that breaks the user experience, and IMO you should fix this asap. Don't get me wrong, I have mine working fine, I'm saying that this is bad for your new user experience.

0 votes
Deleted user February 21, 2012

That did it, I'm good to go! Thanks Steve.

0 votes
Deleted user February 21, 2012

I have this same problem. I have to enter my username and password for every push. I tried the trick above but the URL isn't recognized once I add my login.

I also tried deleting all kiln related items in my keychain, and then logging in again. It appears to have created a new keychain entry and still won't find my info.

Is there a way to fix this?

stevestreeting
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.
February 21, 2012

Hmm, I can't reproduce this with my Kiln account.

I clone from a URL like this: https://mycompany.kilnhg.com/Repo/Repositories/Group/testrepo

In my Keychain I have an entry for mycompany.kilnhg.com, with a username of the form myuser@mycompany.com and the password.

This gets picked up correctly because even though the URL above doesn't have a user name in it, SourceTree has remembered the username I typed the first time I manually logged in. This is stored in ~/Library/Application Support/SourceTree/hostusernamemap.

So here's what I tried:

  1. Deleted ~/Library/Application Support/SourceTree/hostusernamemap
  2. Deleted my Keychain item for mycompany.kinhg.com
  3. Tried to clone from a private Kiln repo, got a user/password prompt as expected
  4. Typed my username (user@mycompany.com) and password, enabled the 'Save in Keychain' option
  5. Clone proceeded as epxected
  6. Cloned again from the same URL
  7. Did not receive a user/password prompt, everything just worked

The only thing I can think of is that the hostusernamemap is wrong somehow, maybe you can try deleting it to reset things. You'll get one more prompt out of that, but after that if the entry is in the keychain and your username is the same it should be automatic.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events