Reputation: 4207
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.
Upvotes: 6
Views: 13890
Reputation: 21
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.
Upvotes: 2
Reputation: 43086
Try adding ssh:// to the remote address. I have never had good luck getting git to work consistently without it.
git clone ssh://[email protected]/opt/git/project.git
Upvotes: 0
Reputation: 31461
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.
Upvotes: 8
Reputation: 301177
The git account may not have read / write access to that repository/branch.
Upvotes: 0