windowsgitpowershellsshwebmatrix

Unable to clone git repository from siteground


I'm trying to set up MS WebMatrix to use a Git repository from my siteground hosting account. I created the repository using their cpanel plugin and it tells me that I can clone it using this command

git clone ssh://username@sm3.siteground.biz:18765/home/username/public_html/

I replaced username of course and I created an rsa key using ssh-keygen. In the Webmatrix GUI it just opens a window saying "Clone is in progress" but it doesn't to anything. And when I run that command in PowerShell, this is the output:

    Cloning into 'public_html'...
    Permission denied (publickey).
    fatal: Could not read from remote repository.

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

Any help is highly appreciated!

EDIT: I haven't used github before but I'm pretty sure I'm not connecting to it. The repository is on siteground's server I think. Anyway, I couldn't figure it out in PowerShell so now I'm using putty to load the appropriate key and connect using an external git tool (source tree) that doesn't use the same ssh client as PowerShell. That is the solution that's working for me now. I'll leave this question open as maybe someone comes around and can help with how to set this up using PowerShell.


Solution

  • The missing piece to the Siteground guide is:

    1. Create a blank file in ~/.ssh/ or C:\Users\username\.ssh on your computer. It does not matter what you name it. I named it siteground_dsa. You could also name it id_dsa_siteground.

    2. Copy the private ssh key that you get from siteground.com and paste the whole of it in the this newly created file.

    3. Open Git Bash locally on your computer and run the following command

      $ eval ssh-agent -s

    4. Then run the following. Remember to use the filename that you gave it.

      $ ssh-add ~/.ssh/siteground_dsa

    5. Now you need to enter the passphrase for the ssh key. You will have defined it when creating the ssh key.

    6. Now you should be logged in and you can run git clone the directory of your wish.

      git clone ssh://username@ams14.siteground.eu:18765/home/username/public_html/

    To permanently add the SSH key extend ~/.ssh/config with the following and updating server_name and username.

    Host server_name
         User username
         Port 18765
         IdentityFile ~/.ssh/siteground_dsa