3

I am trying to set up a remote git server on a mac mini running osx 10.8.2. I have set up ssh so that the clients can connect to the git account on the remote host. When I try to execute git push origin master from one client I get the following error:

bash: git-receive-pack: command not found

fatal: Could not read from remote repository.

(From another client I get:

bash: git-upload-pack: command not found

And fatal error.

I have made sure that git receive pack and git upload pack are installed and in the path on both the client and host.

What can I do to fix or troubleshoot the problem?

Community
  • 1
  • 1
user1790252
  • 506
  • 5
  • 13

1 Answers1

5

Reading through this post helped me figure out how to solve the problem. Because the thread assumes background knowledge that I did not have (and which other novices may not have), I summarize and try to simplify the answer here.

Git push apparently works through a "non-login" account, i.e., one which does not have a password. See here. The path variable for the non-login git account is different from the path for an ordinary login account. Even if you login into the remote machine, typing echo $PATH will still only show your path, not the path of the non-login account. To see what the path of the non-login account is you have to type (from the client):

ssh you@remotemachine echo \$PATH

(The backslash keeps the local machine from intercepting and expanding the $PATH variable before it gets to the remote machine.) Doing so returns the path for non-login accounts. In my case, the default path for non-login accounts did not include the path to the relevant git files. Once I added the path to git-upload &c, everything worked fine. The correct path can be added to the default path for non-login accounts on the remote machine by "setting it in .bashrc (for Bash), .zshenv (for Zsh), .cshrc (for tcsh) or equivalent for your shell."

Hope this helps anyone else with this problem.

Community
  • 1
  • 1
user1790252
  • 506
  • 5
  • 13