breser / git2consul

Mirrors the contents of a git repository into Consul KVs.
Other
763 stars 164 forks source link

Option that allows specifying private key for ssh connection #135

Open Yekut opened 7 years ago

Yekut commented 7 years ago

(This may be feature creeping) Checkout private repo with ssh:// needs private keys - however, currently it seems there's no way to tell git2consul to use which private key. Instead, the key needs to be configured globally or in ssh config. It would be nice to have the option to specify which private key to use, for example via the GIT_SSH_COMMAND environment variable that's been available since git version 2.3 - of course, this might mean support for <2.3 need to be dropped for this feature, but given 2.3 has been out for a while this might not be a significant issue.

Also - thanks, git2consul has been pretty great to use!

calvn commented 7 years ago

Have you tried exporting GIT_SSH_COMMAND to see if it works? git commands are called by child_process.exec(), which should inherit all the parent environment variables by default.

wkk1020 commented 7 years ago

Hi, can you give me an example on how to use GIT_SSH_COMMAND with git2consul?

TomGudman commented 7 years ago

This is also a problem if you want to use deploy keys on Github because github only allows a deploy key to be used ONCE across all your repositories. Consequently with git2consul you can only use ONE deploy key. In short, you are forced to use a dedicated Github user for git2consul.

Be able to set which key to use on a per repo project would be great.