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 [email protected]:/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 [email protected]
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.
Log in to the AWS Management Console. If required, use the region selector in the top right corner to switch to the region where your instance was launched. Select your instance and then select the “Create Image” option in the “Actions” menu. Specify the name for the new image and then click the “Create Image” button.
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 [email protected]:/opt/git/project.git
Git will tell you what command it is running, ex
trace: run_command: 'ssh' '[email protected]' 'git-upload-pack '\''/opt/git/project.git'\'''
You can then try to run that command yourself to eliminate git from the picture:
ssh [email protected] git-upload-pack '/opt/git/project.git'
While it seems unlikely given your reported error message, stracing the command can also provide hints:
strace -o/tmp/tr -s128 -f ssh [email protected] git-upload-pack '/opt/git/project.git'
Report back the debugging information revealed above if there are still problems.
Interesting. I was having a similar problem trying to clone from an external GIT source to an EC2 host. I got things working using some of the above.
It had been failing with:
[ec2-user@*.*.*. mediagoblin]$ sudo git clone git://gitorious.org/mediagoblin/mediagoblin.git
Cloning into mediagoblin...
gitorious.org[0: 87.238.52.168]: errno=Connection timed out
gitorious.org[0: 2a02:c0:1014::1]: errno=Network is unreachable
fatal: unable to connect a socket (Network is unreachable)
I then tried replacing git://
with ssh://
and got:
sudo git clone ssh://gitorious.org/mediagoblin/mediagoblin.git
Cloning into mediagoblin...
The authenticity of host 'gitorious.org (87.238.52.168)' can't be established.
RSA key fingerprint is *:*:*:*:*:**:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitorious.org,87.238.52.168' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
I then ran the original git://
request and it worked.
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With