git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git_connect: allow passing arguments to ssh in GIT_SSH_ARGS

From
Jeff King <peff@peff.net>
Date
Nov 8, 2014, 11:09 UTC
Message-ID
<20141108110958.GB20750@peff.net>
In-Reply-To
<20141108104439.GA89717@melamine.cuivre.fr.eu.org>
On Sat, Nov 08, 2014 at 11:44:39AM +0100, Thomas Quinot wrote:
Show 6 quoted lines
> It may be impractical to install a wrapper script for ssh
> when additional parameters need to be passed. Provide an
> alternative way of specifying these by means of the GIT_SSH_ARGS
> environment variable. Arguments are whitespace delimited following
> usual shell conventions; embedded whitespace can be enclosed
> in quotes, or escaped with a backslash.

This has bugged me before, too. Almost every sub-program invoked by git is done so using a shell, so you can put in arbitrary arguments or even snippets of shell code. But not GIT_SSH.

I think the original reason was to match other programs with similar variables. At this point, we can't just change it on a whim; the quoting requirements are different and it would break people's setups. So your approach of adding a new variable is good (the other option is figuring out a long-term transition plan).

However, I'm not sure adding a separate variable for options is the best we can do. Besides being a bit clunky, it has two big shortcomings:

  1. It's not consistent with other git variables that use the shell
     (e.g., GIT_PAGER).
  2. It's not as flexible as a shell; you can't specify "$HOME/bin/ssh"
     or other even more esoteric things, like dynamically tweaking
     the options based on the environment.

What do you think of adding an alternate variable that is not ssh _arguments_, but rather just a full shell command for running ssh? I'm not sure what it could be called (GIT_SSH_SH is probably too confusing).

Show 5 quoted lines
> I hope I won't stray too far away from established procedures
> with my first contribution to git. This patch adds support
> for a GIT_SSH_ARGS environment variable, providing a way
> of specifying ssh arguments without having to create a
> wrapper script.

The formatting and whatnot of your submission looks fine to me. The patch itself looks reasonable, though I didn't look too closely after making my comments above. :)

-Peff
Previous: Thomas QuinotNext: Thomas Quinot
Message 2 of 15 in “git_connect: allow passing arguments to ssh in GIT_SSH_ARGS”
  1. git_connect: allow passing arguments to ssh in GIT_SSH_ARGSThomas Quinot, Nov 8, 2014
  2. Jeff KingNov 8, 2014
  3. Thomas QuinotNov 8, 2014
  4. 1/2 git_connect: set ssh shell command in GIT_SSH_CMDThomas Quinot, Nov 8, 2014
  5. Jeff KingNov 9, 2014
  6. Thomas QuinotNov 9, 2014
  7. git_connect: set ssh shell command in GIT_SSH_CMDThomas Quinot, Nov 9, 2014
  8. Junio C HamanoNov 9, 2014
  9. Thomas QuinotNov 9, 2014
  10. Junio C HamanoNov 9, 2014
  11. git_connect: set ssh shell command in GIT_SSH_COMMANDThomas Quinot, Nov 9, 2014
  12. Jeff KingNov 10, 2014
  13. Thomas QuinotNov 10, 2014
  14. Junio C HamanoNov 10, 2014
  15. 2/2 git_connect: when using GIT_SSH_CMD, check for plink in argv[0] onlyThomas Quinot, Nov 8, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.