Why do SourceTree prompt for user git when using SSH

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

If you change the remote url to

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

it should not ask you for username anymore.

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

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

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

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.

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
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...

572 views 1 2
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