Re: Specifying a private key when connecting to a remote SSH repo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> We already have GIT_SSH, so I would expect:
>
>   GIT_SSH='ssh -i $HOME/.ssh/id_for_example_com' git push
>
> to work. But sadly, GIT_SSH does not use the shell, unlike most other
> configure git commands. :(

You read me correctly ;-)

> We could consider it a consistency bug and fix it, though I suspect we
> may be annoying people on Windows who have spaces in their paths.

Again, you read me correctly ;-)

> You could write a credential helper shell script that knows about
> classes of remotes (e.g., selecting an identity file based on the
> hostname), and write only a few lines to cover a large number of hosts.

Yes, but the same trick can be used in $HOME/.ssh/config to let one
entry cover the same large number of hosts, so...

> For example:
>
>   #!/bin/sh
>   test "$1" = "get" || exit 0
>   while IFS== read key val; do
>     test "$key" = "host" || continue
>     case "$val" in
>       *.example.com) echo sshident=com_key ;;
>       *.example.net) echo sshident=net_key ;;
>     esac
>   done
>
> But it feels a bit hacky to be using the credential helpers at all for
> ssh connections.

Yeah, perhaps.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]