How do I convince SourceTree to store my password in my keychain? Edited

Using ST v2.5.1 on Mac OS 10.12.5 connecting to a private git server through ssh. Every operation to/from the server requires I enter my password in the pop-up dialog, twice. I have read through all the support articles I can find and none of the solutions/work-rounds work for me. 

The remote URL is of the form myuser@myserver.tld:path/to/origin

I have tried embedded Git and switched ST to use System Git (2.13).Same behaviour using both.

I have carried out push/pull operations in Terminal

I have run ssh-keygen to create new keys

I have created an 'account' for the private URL and enterd my ssh credentials

I have set git config --global credential.helper osxkeychain in terminal

I have checked my keychain and there is no record for ST at the URL of the server. As there is no record I cannot set its permissions (one of the other things I have seen that worked for other people)

Does anyone have any other ideas? Atlassian even suggested that v2.5.x would fix this problem, but not it seems, for me.

3 answers

This widget could not be displayed.
Jesse Yowell Atlassian Team May 25, 2017

Hi Mark,

With 10.12, I believe there is something you can update a setting to include the Keychain: https://developer.apple.com/library/content/technotes/tn2449/_index.html

Also, can you check you SSH config to see if it is pointing to the correct keyfile? (see: https://confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html)

I should also note that if you're not using Bitbucket Server, you shouldn't add the account under "Preferences > Accounts"

Cheers,

Jesse

This widget could not be displayed.

Can you please check your ssh config file once and see if that's fine. And for your kind info, there are new keys on macOS 10.12 to remember password and get the ssh agent use the key - https://developer.apple.com/library/content/technotes/tn2449/_index.html

 

Thanks!

Thanks for the quick responses guys. I followed technote 2449, added UseKeychain yes and AddKeysToAgent yes. Made no difference.

I verified the agent is running.

I tried the steps to create an identity in ~/.ssh/config for the url I am trying to login to. Again saving the UseKeychain etc but ST still refuses (or is being refused) to place an item in the keychain.

And yes I quit ST and started again after each step of changes to ensure that it was using the latest ssh config

Anything else to try?

Jesse Yowell Atlassian Team May 25, 2017

Can you try restarting the SSH service?

sudo launchctl stop com.openssh.sshd

(it should automatically restart)

This widget could not be displayed.

What I've done with success :

open in hom dir  ~/.gitconfig , and add :

[credential "https://domaint.private.server"]
username = myusername@me.com
helper = store

one for each server !

I have tried all the techniques all the helpful people here have suggested and it still does not put anything into the keychain. I uninstalled the app, switched to the admin user, downloaded another copy, installled that and it DOES put an entry in the keychain and only asks for the password once. So I switched back to my user account, installed a fresh copy of ST and was ever hopeful it would work. It did not. 

 

So my conclusion is this is a permissions issue rather than any kind of unique git setup. Why does ST when running in my user account not store details in my keychain but an admin user does?

I also tried a different approach, but it only highlights what I believe is the root cause: I tried to clone a new repo. When entering the url I deliberately left off the username part of the url. ST correctly asks me for the authentication details. I entered the username and password. Store Password in Keychain was ticked. After entering the details, it came back to ask me for it all again. This repeated many times until I got bored and clicked cancel instead.

This confirms to me it is a permissions issue with ST negotiating with the keychain incorrectly. Is this fixable?

Hi Mark,

I encountered almost the same problem as you. The symptoms appeared when I used a Windows version SourceTree to update the repository and I thought I'd screwed up the repository because of the CRLF issue. However, I had another Mac that works very well with the repository. On the Mac that has the problem, I notice that the password with key name "<git server IP> Access Key for <user ID>" was missing. So, I tried to manually create that key but seems I cannot update the "Where" field to "SourceTree". Then, I deleted all password keys for that GIT server in the Keychain, uninstall and SourceTree again, the problem then solved. Now the password key "<git server IP> Access Key for <user ID>" appear again. Hope this help.

Thanks. It is now fixed. The important thing that finally solved this was the fact that the keychain had an entry I had not expected. There was an entry for the numerical IP eg 99.100.101.102 as well as its domain name eg mygit.server.com. Once I had cleared the numerical address, SourceTree would create one for the domain address. There's two months of my life I won't get back. But thanks to Joseph, I have now at least got over the password not saving problem.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

860 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you