I want to specify a lot of options for SSH when Git uses it. We're using ISPConfig, which sets the owner of the web users' home directory to root, which causes a lot of trouble, including that I can't set any SSH configuration. Setting the $HOME variable doesn't work either. I have to craft my git commands to use a different SSH config file. How is that possible?


If you can set environment variables, I would first try something like

export GIT_SSH_COMMAND="ssh -F /path/to/config"

However this will only work with Git 2.3+. Assuming you're on an older version, you'll need something slightly more involved:

echo "ssh -F /path/to/config-file" > /some/path/git-ssh-wrapper
chmod +x /some/path/git-ssh-wrapper
export GIT_SSH="/some/path/git-ssh-wrapper"

This is because (from git man page):

To pass options to the program that you want to list in GIT_SSH you will need to wrap the program and options into a shell script, then set GIT_SSH to refer to the shell script

  • Does that mean the /some/path/git-ssh-wrapper will need chmod +x? – Paul Mar 19 '15 at 21:24
  • Good point - yes it will. Edited. – Nye Mar 23 '15 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.