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

Sourcetree with Gitlab - SSH not working

Joshua Hartwig
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 11, 2013

Hi,

I have been evaluating using Sourcetree for Windows with a Gitlab server. I have been able to clone, push, and pull correctly over HTTP. This was not possible until I correctly uploaded my public SSH key to the server and pointed Sourcetree and my HOME environment variable to the private key. However, I am still unable to connect via SSH.

Using the git bash, running "ssh -vvvT git@SERVER" prompts me for my SSH key password, then connects correctly (responds with a welcome message as well). This indicates that my SSH key is set up correctly.

When attempting to clone an existing test repository, using the path "git@SERVER/REPO_DIR.git" results in an invalid source path. Clicking details gives me the following:

"fatal: 'xxxxxx' does not appear to be a git repository
fatal: could not read from remote repository.

Please make sure you have correct access rights and the repository exists"

When attempting to clone the repository, using the path "ssh://git@SERVER/REPO_DIR.git" results in and invalid source path with the following details:

"Access denied
Access denied
Access denied
Access denied

FATAL ERROR: Server sent disconnect message type 2 (protocol error):
'Too many authentication failures for git'
fatal: could not read from remote repository

Please make sure you have correct access rights and the repository exists"

Again, this works over HTTP flawlessly. My user account has been created and my SSH key is correctly stored. Why am I still having trouble with SSH? Are there other SSH commands I should run in the git bash to debug this issue?

7 answers

7 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.
July 18, 2013

Apologies for the late response, I've been out of the office for a week.

It sounds like you're using OpenSSH keys (and not PuTTY), did you choose the OpenSSH option in the setup wizard? If not, you can set this in Tools > Options > General > SSH Client - it should pick up your key location automatically if it's the standard ~/.ssh/id_rsa but otherwise you can specify it. If your key is protected by a passphrase, you'll be prompted to supply it in a pop-up terminal window when you confirm the settings, and when you start SourceTree next time - this is necessary so that there is an instance of ssh-agent running that SourceTree can talk to with your key loaded.

If you need to load more than one key into your agent, you can do this from the Tools menu, Add SSH Key.

Once you have this configured SourceTree should behave just like the command line since OpenSSH picks up all the same configuration files.

edrandall February 9, 2015

this is far too difficult, why can't it "just work"

David_ducrest
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 24, 2015

I'm experiencing a similar error, how I'm not using OpenSSH. My SourceTree client is running on a Windows machine with PuTTY/Plink selected. Any suggestions?

LiuKeith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 25, 2018

This resolved my issue. Thanks! 

Jacob Andersson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2018

Resolved my issues

amol Chaware September 24, 2019

Thanks, but now I have getting a new issue.

Permission denied (password,keyboard-interactive,publickey).
fatal: Could not read from remote repository.

Awais
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 20, 2020

@stevestreeting thanks a lot. Your provided solution solved my issue with keys. 

0 votes
Renee Harbison
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 14, 2019

Hello! This worked for me, but only with the ssh key, and not with the username and password.

After I added the ssh key to sourcetree, I changed the settings in Tools -> Options -> SSH-Client to work with PuTTY / Plink.

I ran into a problem after I added the ssh key because I forgot to restart sourceTree. Hope this helps.

custom writing services

0 votes
Robert_Karajev
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 4, 2019

Thnx!! This worked!!! simply just use OpenSSH instead of Putty as option and it will work

0 votes
adithya reddy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 23, 2018

I am using putty for the key. I had this issue and Adding key again at Pageant(PuTTY authentication agent) from windows quick icons on the bottom right end near time solved it. Good luck! 

Jens Scholz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 4, 2018

yay!

0 votes
BustaPaladin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2016

I have the same issue. I imported my key but it doesn't work for me. Bitbucket SSH > clone locally > spotless

 

 

Try from gitlab and the horrors begin... 

0 votes
alirezahanifi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 8, 2015

use http url instead of git url like bellow :

http://server/user/project.git

0 votes
jcespinoza
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 24, 2015

In my case I wasn't prompted for the pass phrase and starting SourceTree from the Command Line, fixed it. The prompt closed inmediatelly after popping up

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events