Connect SourceTree and own Server
Asked by Mainboarder:

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:

* <ssh://git@fq.dn:22/test.git>
* git@fq.dn:test.git
* git@fq.dn:22/test.git
* or any other

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?


Answers:
author: Mainboarder
body: With <ssh://git@IP-Adress/path/git.git> it works. Maybe there is a DNS Error with my server.

comments: author: Mainboarder
body: 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!


author: stevestreeting
body: 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.

comments: author: Mainboarder
body: 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 :/


author: stevestreeting
body: 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.


author: Mainboarder
body: 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](http://mainboarder.de/data/atlassian.png).

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.


author: Mainboarder
body: 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](mailto:git@fq.dn) =\> Permission denied (publickey)

I go on with my tests tomorrow.


author: Mainboarder
body: 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).


author: Yannick Widmer
body: 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.


author: Mainboarder
body: 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


author: KieranA
body: 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

comments: author: Mainboarder
body: 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/](ftp://user:pass@fq.dn/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


author: KieranA
body: What happens when you do it from the terminal?


author: Mainboarder
body: 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


author: Mainboarder
body: 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?