From: Junio C Hamano Date: Tue, 20 Mar 2012 01:55:06 GMT Subject: Re: [PATCH] Use SSH key from `GIT_SSH_KEY` variable if supplied Message-ID: <7vhaxk829x.fsf@alter.siamese.dyndns.org> In-Reply-To: <1332207557-10965-1-git-send-email-me@mmalecki.com> Maciej MaƂecki writes: > if (protocol == PROTO_SSH) { > + const char *key; > const char *ssh = getenv("GIT_SSH"); > int putty = ssh && strcasestr(ssh, "plink"); > if (!ssh) ssh = "ssh"; > @@ -589,6 +590,13 @@ struct child_process *git_connect(int fd[2], const char *url_orig, > *arg++ = putty ? "-P" : "-p"; > *arg++ = port; > } > + > + key = getenv("GIT_SSH_KEY"); > + if (key) { > + *arg++ = "-i"; > + *arg++ = key; > + } Hmm. I am somewhat torn. The minimalist in me finds this extraneous and unnecessary noise. Why should the user always set GIT_SSH_KEY environment variable that only applies to git and does not help his other ssh sessions? Why isn't having an entry in .ssh/config to name IdentityFile sufficient? On the other hand, the feature-creepist in me finds this somewhat lacking. Why should we give special treatment only to "-i $identity_file" option [*1*] and not others? Do we have to invent new environment variables if we wanted to pass "-c $cipher_spec", "-l $login_name", "-I $pkcs11", "-4", "-6", or "-b $bind_address"? Would GIT_SSH_ARGS='-i /home/me/.ssh/there.pub -l me' be more appropriate? [Footnote] *1* In any case, GIT_SSH_KEY is misnamed. It should match whatever word ssh(1) uses to describe the concept--in this case, it is "identity file".