Search code examples
gitsshgithubdreamhostssh-keys

clone a github repo to a live site but getting: Permission denied (publickey). fatal: The remote end hung up unexpectedly


I'm trying to get my github repo cloned on my live site for the first time.

I pushed my public key out to my dreamhost server's home directory from my local terminal like so:

cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'

This didn't cause any errors and i can see my key on the remote server but when I try to clone a github repo after sshing into my remote server with:

git clone [email protected]:gituser/myrepo.git myserver.com/mysite

I get:

Cloning into mysite...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

I can push files from my local to github just fine (after a day of tweaking ;) ).

How do I clone from github to my remote server (live site)?


Solution

  • You'll need to push the public key of your remote server to github. If you haven't already generated the key, start at step one, https://help.github.com/articles/generating-ssh-keys. Otherwise, start from step 4 where it shows you how to add the key to your github account.