Connect SourceTree and own Server

Hello,

I want to use SourceTree with my own server.

I created a user "git". In his home directory is test.git. In the .ssh/authorized_keys is the ssh-key.

I can connect via putty with the other part of that key in that account.

When I want to connect via SourceTree with an URL like:

I get an error:

Access denied
Access denied
Access denied
Access denied

"Too many authentication failures for git"...

In the auth.log I don t find any message that SourceTree contacted the server. There is just no message about those incidents.

What am I doing wrong?

5 answers

1 accepted

With ssh://git@IP-Adress/path/git.git it works. Maybe there is a DNS Error with my server.

I used git.domain.tld for bitbucket so maybe sourcetree adds automatically git as subdomain and does a dns lookup. so it failed for me.

But that is just one theory.

Thanks for your help!

Ok, now I found the following line:

Aug 12 21:23:45 Hostname sshd[29724]: Invalid user git-upload-pack 'git from 92.206.24.64

But I tried it with git@fq.dn:22/test.git

So why does it use "git-upload-pack 'git" as username?

Is that my fault or a bug in SourceTree?

Hi Mainboarder,

It's probably worth checking out the URLS section of the Git docs here: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS

As you can see you're saying your username is 'git' according to the docs. To break it down, here's the format:

protocol://user@url.com:port/path

Hope that helps

Hi Kieran,

thanks for your answer.

I tried it before with that format. But then I get the message:

Access denied
Access denied
Access denied
Access denied

"Too many authentication failures for git"...

And I don t see anything in the auth.log (tried with ssh) about this incident.

I tried also with ftp. I have to use the following URL:

ftp://user:pass@fq.dn:21/path/test.git/

With my browser I see the directory. But Sourcetree gives back: "fatal: unable to access URL: RETR response: 550".

Without the password in the URL I will not be asked for it and it fails :(

Just for the records:

drwxrwsr-x 2 git git 4096 13. Aug 15:21 branches
-rw-rw-r-- 1 git git 126 13. Aug 15:21 config
-rw-rw-r-- 1 git git 73 13. Aug 15:21 description
-rw-rw-r-- 1 git git 23 13. Aug 15:21 HEAD
drwxrwsr-x 2 git git 4096 13. Aug 15:21 hooks
drwxrwsr-x 2 git git 4096 13. Aug 15:21 info
drwxrwsr-x 4 git git 4096 13. Aug 15:21 objects
drwxrwsr-x 4 git git 4096 13. Aug 15:21 refs

What happens when you do it from the terminal?

For FTP: the same error.

But ssh: via root without ssh-key it works.

I used the same URL in SourceTree, it asked for password, but fails... Access denied. Server sent disconnect message Type 2.

P.s: I use win 8 64bit and mingw32

Hi Kieran,

thanks for your answer.

I tried it before with that format. But then I get the message:

Access denied
Access denied
Access denied
Access denied

"Too many authentication failures for git"...

And I don t see anything in the auth.log (tried with ssh) about this incident.

I tried also with ftp. I have to use the following URL:

ftp://user:pass@fq.dn:21/path/test.git/

With my browser I see the directory. But Sourcetree gives back: "fatal: unable to access URL: RETR response: 550".

Without the password in the URL I will not be asked for it and it fails :(

Just for the records:

drwxrwsr-x 2 git git 4096 13. Aug 15:21 branches
-rw-rw-r-- 1 git git 126 13. Aug 15:21 config
-rw-rw-r-- 1 git git 73 13. Aug 15:21 description
-rw-rw-r-- 1 git git 23 13. Aug 15:21 HEAD
drwxrwsr-x 2 git git 4096 13. Aug 15:21 hooks
drwxrwsr-x 2 git git 4096 13. Aug 15:21 info
drwxrwsr-x 4 git git 4096 13. Aug 15:21 objects
drwxrwsr-x 4 git git 4096 13. Aug 15:21 refs

By default the Windows version of SourceTree uses PuTTY as its SSH implementation, which is the Windows-friendly version of SSH. You seem to be using the MingW/Cygwin ports of OpenSSH though, which you can use but you need to tell SourceTree that's your preference. We ask this in the setup wizard but you might have skipped through it.

Please open Tools > Options and change your SSH Client setting to OpenSSH. If you're using the standard SSH key locations then SourceTree should find id_rsa and prompt you for any passphrase.

Hi Steve,

thanks for your answer!

I have installed git before sourcetree (in former times I had to use TortoiseGit, which needed this). When I opened the bash for git this is MingW (I did it for the test Kieran asked for).

So now I imported the embedded git and choose it (to not use OpenSSH). I also loaded the key into pageant. But SourceTree asks for a password.

On the server I set the ssh-deamon to also accept passwords.

But the access denied error is coming :(

The key has no passphrase but is in TrueCrypt which is mounted in U:/ (maybe this helps?) The name is git.ppk.

Also I have to add everthing works with bitbucket and SSH-Keys. I do also use the same key for bitbucket and the server (for testing).

Many thanks for your help! This is really frustrating :/

Oh OK, if you switch to PuTTY instead (a .ppk file) then please leave the SSH Client setting in Tools > Options as PuTTY.

If you get prompted for a password, this means the key authentication failed. Are you sure that the public key corresponding to git.ppk is in your authorized_keys file on your server? You can easily access the public part by opening PuTTYgen - which you can do from SourceTree under Tools > Create or Import SSH Keys - and loading git.ppk. The public part is at the top of the window and you can copy/paste that into your authorized_keys file on your server. If you already have a different public key in there already (like a different OpenSSH key), you can paste it on the next line, allowing both keys to work.

Oh, also if you're not already loading the PuTTY key agent 'Pageant' at login, then make sure in Tools > Options that you've pointed the SSH Key field at your git.ppk and checked the box 'Automatically start SSH agent when SourceTree opens'. This makes sure your key is always available.

I have verified all of this.

With putty I am able to login to my server with this key as git.

I also use just one key (for the beginning I wanted to have everything simple).

Here are my settings.

U:/ is the mounted TrueCrypt-Container. Pageant is loaded.

When I click on terminal MingW32 opens up (so does it use OpenSSH instead of PuTTY?).

I also wonder, why it didn t worked, when I also accepted passwords for ssh-login.

Ok, I tried it again in both terminals, the one from SourceTree and my system git.

On both the key login fails. So obviously the error is there:

ssh git@fq.dn => Permission denied (publickey)

I go on with my tests tomorrow.

If I try with git protocol:

"fatal: unable to connect to :

some ipv6-Adresses errno=No such file or directory"

I don t have IPv6 but the server has (but no IP which was given in the errormessage).

I was prompted to give the ssh  key in the setup wizard but I couldn't change from putty to OpenSSH, So your solution worked but your first comment seems to be not completely correct.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

262 views 0 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot