I was reading the question Tell git which private key to use, and the answer doesn't apply for a case were the user doesn't have any home directory.

We're setting up a Jenkins server right now, and the user who run Jenkins doesn't have any home folder. But that particular user must access a GIT repository.

How can the user running GIT use a key authentication?

  • // , What if the machine doesn't even have the key in question? Can one specify which forwarded identity to use? Sep 11, 2015 at 19:37

1 Answer 1


The environment variable GIT_SSH tells git what ssh exectutable to use. So you could create a script something like:

/usr/bin/ssh -i /path/to/identity.file "$@"

Then chmod it executable, and set GIT_SSH=/path/to/sshscript

  • advancing to the next roadblock: my ssh client then tries to update known_hosts and that fails!
    – GLRoman
    Aug 29, 2018 at 21:41
  • 1
    @GLRoman The UserKnownHostsFile option let's you specify where the file should be
    – Paul
    Aug 29, 2018 at 22:09

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.