Why do SourceTree prompt for user git when using SSH

tkhduracell
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.
March 31, 2015

I'm using SourceTree with my native system Git, that have all SSH keys setup. Running git push / git pull from the terminal works fine, but using the SourceTree buttons it prompts for a git user.
My question is really how to get this working...

Screenshot 2015-04-01 10.42.22.png

filip➜~/GitMigration/test(master)» git remote -v
origin git@git.company.com:main/devops.git (fetch)

origin git@git.company.com:main/devops.git (push)

Pushing from terminal

filip➜~/GitMigration/test(master)» git push
 Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 943 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To git@git.company.com:devops/devops.git
   27d45ef..f834554  master -> master
filip➜~/GitMigration/test(master)» which git
/usr/local/bin/git

Pushing from Sourectree

It prompts for the git user password, I press cancel trice:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/master:refs/heads/master 
Pushing to git@git.company.com:main/devops.git
2015-04-01 10:58:28.811 SourceTreeLogin[1133:2214511] Error (internetKeychainItemForServer:withUsername:path:port:protocol:) - The specified item could not be found in the keychain.
User cancelled password prompt.2015-04-01 10:58:30.580 SourceTreeLogin[1133:2214511] User cancelled password prompt.
Permission denied, please try again.
2015-04-01 10:58:30.656 SourceTreeLogin[1134:2214552] Error (internetKeychainItemForServer:withUsername:path:port:protocol:) - The specified item could not be found in the keychain.
User cancelled password prompt.2015-04-01 10:58:32.450 SourceTreeLogin[1134:2214552] User cancelled password prompt.
Permission denied, please try again.
2015-04-01 10:58:32.510 SourceTreeLogin[1146:2214673] Error (internetKeychainItemForServer:withUsername:path:port:protocol:) - The specified item could not be found in the keychain.
User cancelled password prompt.2015-04-01 10:58:33.601 SourceTreeLogin[1146:2214673] User cancelled password prompt.
Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Completed with errors, see above

Versions

git version 2.3.2
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
SourceTree version 2.0.5.2 (2.0.5.2)

5 answers

0 votes
Gabriel Cook June 5, 2017

I had a similar issue and needed to provide my password for my SSH key (id_rsa). The prompt was not clear for me, but that did resolve it.

0 votes
Grant Kemp October 5, 2016

Basically Source tree has a major problem processing accounts if you have 2 factor or use things like app passwords  I logged a question previously - and was told how to to use app passwords - but the problem is that Sourcetree is has a major bug which they aren't fixing. 

I am moving to an alternative git client till they add proper support for 2 factor or improve their implementation to remember passwords.

0 votes
tkhduracell
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.
April 2, 2015
I've tried with this configuration, but it still prompts for git user
filip➜~/GitMigration/devops(master)» git remote -v
origin ssh://git@git.company.com:main/devops.git (fetch)
origin ssh://git@git.company.com:main/devops.git (push)

If I use this:
filip➜~/GitMigration/devops(master)» git remote -v
origin ssh://git.company.com:main/devops.git (fetch)
origin ssh://git.company.com:main/devops.git (push)

We use GitLab, and it explicitly tell me to use:
git@git.company.com:main/devops.git
0 votes
Tim Crall
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.
April 1, 2015

 I always use git@ when doing SSH.  Have you tried putting ssh:// into the URL, though?

tkhduracell
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 5, 2015

"I don't handle ssh://" it says.

0 votes
Silviu Burcea
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.
April 1, 2015

If you change the remote url to

someUserName@git.company.com:devops/devops.git

it should not ask you for username anymore.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events