I’m attempting to put a bare git repository on a ubuntu server running on Amazon EC2. The difficulty I’m having is getting git to clone the repository from my local pc.
When I try:
git clone git@ec2-blah.compute-1.amazonaws.com:/opt/git/project.git
I get:
Cloning into project...
Unable to open connection:
Host does not existfatal: The remote end hung up unexpectedly
Yet I don’t have any difficulty ssh’ing into the same server. For example the following works fine:
ssh git@ec2-blah.compute-1.amazonaws.com
My thinking was that if this is working, then I have my keys set up appropriately on the client, and on the server. Therefore the git clone command should work as well.
But no.
I’ve researched and tried a number of variations, but I just have hunch I’m missing something brain dead simple.
Check to make sure git is doing what you think it is doing, and then try the exact command git is using to contact the remote server.
Run
GIT_TRACE=1 git clone git@ec2-blah.compute-1.amazonaws.com:/opt/git/project.gitGit will tell you what command it is running, ex
You can then try to run that command yourself to eliminate git from the picture:
While it seems unlikely given your reported error message, stracing the command can also provide hints:
Report back the debugging information revealed above if there are still problems.