When you type ssh in the field and get an invitation, you are actually doing a little process than when you execute the command. The shells have rules about what configuration will be obtained based on whether it is a login shell and / or if it is an interactive session. Try to run:
ssh user@host env
This will print your environment, as seen from a non-interactive login session. I assume that /usr/local/git/bin not on the path in this script. You can get around this using the --receive-pack option for git push :
git push --receive-pack=/path/to/git-receive-pack
/path/to/git-receive-pack - the path on the remote computer. It tells git where to find the other end when ssh'ing on the remote.
The best answer is to fix your shell configuration, but it can be difficult depending on the shell. I mainly use ZSH, and fix it by setting ~/.zshenv , which gets ZSH in a non-interactive shell. I think with bash things are less clear. You may need to change your ~/.bashrc and / or your ~/.bash_profile .
Assuming you have an installation installed on the Vanilla Linux platform at the remote end (which is probably the case), and that it starts the bash shell, the easiest solution is to modify .bashrc . Change ~/.bashrc and add:
export PATH=/path/to/your/installed/git/bin:$PATH
Where /path/to/your/installed/git/bin is the place where you installed git in your home directory. I tend to set local settings in ~/.local/bin , so my view would look like this:
export PATH=$HOME/.local/bin:$PATH
Perhaps you are just:
export PATH=$HOME/bin:$PATH
You do not provide a location, so I cannot give you the correct wording.
Most systems use .bashrc even if the command is provided by ssh. After you make this change, try ssh user@host env again. You should see the location of the bin folder containing the git binary in the path variable. Then you can do something like ssh user@host git --version and see something like:
git version 1.8.2
If you see an error, then you probably didn’t enter the path correctly, or .bashrc does not pick up when you ssh into the machine.
.Profile example
# if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi # set PATH so it includes user private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
Automatic use --receive-pack
Assuming your remote is called origin , you can do this:
git config --local remote.origin.receivepack \ /path/to/git-receive-pack/on/the/remote
You may also need to fix the download package:
git config --local remote.origin.uploadpack \ /path/to/git-upload-pack/on/the/remote