tags:

views:

5081

answers:

4

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?

+2  A: 

Have a look at this thread: http://kerneltrap.org/mailarchive/git/2008/3/6/1092284. It seems to be a path issue.

Alan Haggai Alavi
+6  A: 

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.

Jakub Narębski
A: 

I had the same problem on mac os, and I solved this by copy the git-upload-pack from /usr/local/git/bin to /bin.

whitefoxx
That's not fixing the issue, he needs to add PATH to his environment. Why move binaries around?
luckytaxi
It's already included in the PATH, and still has the problem, I don't know why, so I moved it to the bin and it works. Maybe you are right, but that was exactly how i solved this in my computer.
whitefoxx
+1  A: 

Another way would be to do:

git clone -u /path/to/git-upload-pack ssh://user@host/~/project/path/contactdb

Michael Willer