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/
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
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
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.