It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,935 views 0 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you