git-upload-pack: command not found

So you installed git and ikiwiki on your shared server and created your ikiwiki and repositories, but when you went to create a local working clone of the repository by running:

git clone <server-alias>:/path/to/<repository-name>.git

did you get the following error, like I did?

Cloning into <repository-name>...
jailshell: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

Don’t worry, it’s not a difficult problem to solve, it’s just that the PATH variable that points to where your local git-install programs are is not being read for non-interactive shell. To test what the non-interactive PATH variable for your account on the server is, run the following from your local machine:

ssh <server-alias> echo \$PATH

If the local git install path you set in `.bashrc` is not present (eg. /home/<username>/bin), the server is ignoring the path directive in this file (and presumably those from places like `~/.ssh/environment` too).

To resolve this, explicitly set the path for `git-upload-pack` as part of the clone command:

git clone -u /path/to/git-upload-pack <server-alias>:/path/to/<repository>.git

This is only good for the initial clone however; to remove the requirement to set the path for git-upload-path/git-receive-pack every time you do a pull from/push to the repository respectively, set the path for each in the newly created, local git repository’s config.

git config remote.<remote-name>.uploadpack /path/to/git-upload-pack
git config remote.<remote-name>.receivepack /path/to/git-receive-pack


Source: stackoverflow.com/questions/225291


If you’re still typing in the full <username>@<server.url> with ssh and scp commands instead of ssh <server-alias>, do yourself a favour and setup a server alias in your ~/.ssh/config directory

Host <server-alias>
HostName <server.url>
User <username>
Port <port number>

If you’re still using password logins with ssh and scp, look into changing to a key based passwordless login — either with or without a key password as appropriate.

This entry was posted in ikiwiki.
Bookmark the permalink.
Follow any comments here with the RSS feed for this post.
Trackbacks are closed, but you can post a comment.
The short url for this post is: http://def-proc.co.uk/b/dnazi

Post a Comment

Your email is never published nor shared.
Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>