Git – Why is this git clone command failing


Trying to use the git clone command. My understanding (please correct if wrong) was that in order to host a Git repository you just need a machine running ssh and the project/repository sitting on it in a permitted location.

I have my git repository on an OS X system that's running ssh. I'm trying to clone it on a Windows XP system. I have Git Bash installed on the XP machine. In the Git bash (MINGW) console, I can ssh into the Mac no problem.

However, git clone fails…

$ git clone username@host:~/project/path/contactdb
Initialized empty Git repository in 
  c:/Documents and Settings/Administrator/My Documents/projects/contactdb/.git/
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

Tried it with and without .git extension:

$ git clone username@host:~/project/path/contactdb

$ git clone username@host:~/project/path/contactdb.git

Do I need something else installed on the Mac?

Best Solution

You need to have Git installed on the machine that has Git repository you want to clone; also git-upload-pack has to be in $PATH on remote machine when doing ssh. Do you get something like the following response when directly ssh-ing to remote machine:

$ ssh username@host git-upload-pack --help
usage: git upload-pack [--strict] [--timeout=nn] <dir>

or the following (wrong) response:

$ ssh username@host git-upload-pack --help
bash: git-upload-pack: command not found

(of course name of shell depends on what remote side is using).

What also might be problem (although perhaps not in your case) is having misconfigured remote machine so that uses interactive shell for ssh connection, either giving some messages on connection, or setting interactive variables like infamous $CDPATH environmental variable.