i have my own git server but i cant get ssh keys to work
Asked by Paul Boudreau:

Hi,

I hope someone can help me. I want to use Source tree as my git clients. I installed git server on a virtual linux debian server. It seems to be running except i cant seem to get the ssh keys to work.

here is some of my setup. I'm not sure what other information might be needed to help with my question but ill provide anything needed if you let me know

on linux i created a user called orbusgit. The server is on our internal network at 192.168.254.54. The git repository is at /home/orbusgit/repository/inhouseasp/live.git

Here is what i am trying to use in source tree

2016-03-25_8-06-50.jpg

I used puttygen to generate a private key and i put that file in my documents folder. In source tree \> tools \> options\> General \> SSH Client Configuration \> SSH Key is pointing to this file.

SSH Client Putty/Plink

2016-03-25_8-27-44.jpg

The linux server side is the part i'm not sure i'm doing right.

On the putty Gen i clicked the save public key and i ftp'ed this file to the linux git server.

I then put the contents of the public key file into /home/orbusgit/.ssh/authorized_keys

```
cat /tmp/publickey.pub &gt;&gt; /home/orbusgit/.ssh/authorized_keys
```

This is the part i probably got wrong but i am not sure how to do it correctly.

When i try to connect with Atlassian it looks like this.

2016-03-25_9-37-39.jpg

any help would be appreciated

Paul  
[](https://community.atlassian.com/t5/Sourcetree-questions/i-have-my-own-git-server-but-i-cant-get-ssh-keys-to-work/qaq-p/106017?attachment-id=1970){#link_117311a85be5b2}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/2989/1/2016-03-25_9-37-39.jpg){#display_117311a85be5b2_0}  
[](https://community.atlassian.com/t5/Sourcetree-questions/i-have-my-own-git-server-but-i-cant-get-ssh-keys-to-work/qaq-p/106017?attachment-id=1971){#link_117311a85be5b2_0}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/2989/2/2016-03-25_8-06-50.jpg){#display_117311a85be5b2_2}  
[](https://community.atlassian.com/t5/Sourcetree-questions/i-have-my-own-git-server-but-i-cant-get-ssh-keys-to-work/qaq-p/106017?attachment-id=1972){#link_117311a85be5b2_1}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/2989/3/2016-03-25_8-27-44.jpg){#display_117311a85be5b2_4}


Answers:
author: Seth
body: It might be a situation where the underlying SSH software needs some sort of interactive confirmation before connecting. What happens if you connect to the server with PuTTY or SourceTree's Terminal (ssh orbusgit@192.168.254.54)?

comments: author: Paul Boudreau
body: well.. my understanding of ssh and the keys is that its supposed to be a secure way to communicate that eliminates the need for user input/passwords. I would think that asking for a confirmation would defeat the purpose.

ok... i might be getting somewher on this... ok.. in putty i go to the connection category. SSH \> Auth. In the authentication parameters i brows to my private key (the same one i point source tree at in tools \> options\> General \> SSH Client Configuration \> SSH Key

Then i go back to session and in the host name i type "ssh://orbusgit@192.168.254.54"

I get the following

2016-03-25_12-23-29.jpg

This tells me that it is hitting the server but the key on the server isn't the one i want it to point to.

ok.. so now my question is, how do i figure out where the key is that the server is pointing at?


author: Seth
body: That has nothing to do with your key. This is the standard procedure when connecting to a new server. Your key will allow the server to confirm your identity, but the SSH client has no way to confirm the server's identity.

So, the first time you connect, it asks you to take responsibility for this confirmation. If you say "Yes", PuTTY will cache that rsa2 key fingerprint, and will use that to confirm the identity of the server for all future connections.

TL;DR - If you are confident that there isn't a 3rd party executing a man-in-the-middle attack between you and the server, hit "yes", then everything will work.


author: Seth
body: You can also document that fingerprint somewhere, and other users connecting to the same server for the first time can compare the fingerprints so they can be 100% confident that "yes" is secure.


author: Seth
body: [http://the.earth.li/\~sgtatham/putty/0.60/htmldoc/Chapter2.html#gs-hostkey](http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter2.html#gs-hostkey)


author: Paul Boudreau
body: i think i understand. I am on a secure network and i'm sure there is no man in the middle attack.

the thing is, i just used putty for a test. I want to use source tree at the end of the day


author: Seth
body: You only need to use PuTTY once (per client computer) to accept the fingerprint. I've never lost an entry from PuTTY's registry cache short of reformatting my computer, or manually removing an entry.


author: Paul Boudreau
body: Seth, let me see if i understand what you are saying.

You are saying i just need to login with putty the first time and go through the prompts that pop up, from then on i can login with sourcetree with the same ssh private key i used in putty?


author: Seth
body: Yes.


author: Vitalii Petrychuk
body: You have a typo in "Source Path" field, should be `ssh://` instead of `ssh:/`

comments: author: Paul Boudreau
body: i thought that might be the problem also. the example i had found in google showed one "/". i've tried 2.

it just keeps spinning on "checking source...."

I think it times out at some point


author: Seth
body: It should definitely by ssh://