New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GIT_SSH_COMMAND instead of GIT_SSH #1421

Closed
psharpNumerex opened this Issue Apr 22, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@psharpNumerex
Copy link

psharpNumerex commented Apr 22, 2015

If the :application or :tmp_dir variables contain the string 'plink', then git will add -branch to the args for a git command.

This is a poorly documented 'feature' of git to add support for putty, but it causes getaddrinfo errors on Ubuntu when it tries to use -branch as the host.

GIT_SSH_COMMAND takes precedence over GIT_SHH, however.

Currently, I can work around this by simply changing the name of the application variable, but this is not ideal.

There are differences in how the two variables are treated, so a good alternative might be to be able to set the entire git_ssh.sh path in a variable.

@leehambley

This comment has been minimized.

Copy link
Member

leehambley commented Apr 22, 2015

Acknowledged, so as a workaround, can you monkey patch/modify this to work for you? And could you check the CONTRIBUTING guidelines, and send us a PR, this seems like a no-brainer, but I'll need to check (I'll link them here) the Git docs, and try and find a citation for the plink "feature".

@leehambley

This comment has been minimized.

Copy link
Member

leehambley commented Apr 22, 2015

First citation: http://man7.org/linux/man-pages/man1/git.1.html

GIT_SSH, GIT_SSH_COMMAND
           If either of these environment variables is set then git fetch
           and git push will use the specified command instead of ssh when
           they need to connect to a remote system. The command will be
           given exactly two or four arguments: the username@host (or just
           host) from the URL and the shell command to execute on that
           remote system, optionally preceded by -p (literally) and the port
           from the URL when it specifies something other than the default
           SSH port.

           $GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is
           interpreted by the shell, which allows additional arguments to be
           included.  $GIT_SSH on the other hand must be just the path to a
           program (which can be a wrapper shell script, if additional
           arguments are needed).

           Usually it is easier to configure any desired options through
           your personal .ssh/config file. Please consult your ssh
           documentation for further details.

And, the second: https://github.com/git/git/blob/7c597ef345aed345576de616c51f27e6f4b342b3/connect.c#L747-L756

ssh = getenv("GIT_SSH_COMMAND");
if (ssh) {
    conn->use_shell = 1;
    putty = 0;
} else {
    ssh = getenv("GIT_SSH");
    if (!ssh)
        ssh = "ssh";
    putty = !!strcasestr(ssh, "plink");
}
@psharpNumerex

This comment has been minimized.

Copy link

psharpNumerex commented Apr 22, 2015

I have also submitted a bug report to the git mailing list. Their check for putty is overly broad and I couldn't find it documented anywhere other than looking at the source.

My only concern about just replacing GIT_SSH with GIT_SSH_COMMAND is that the latter is shell interpreted. Currently, this is not an issue but something to be mindful of if it changes content in the future.

@leehambley

This comment has been minimized.

Copy link
Member

leehambley commented Apr 22, 2015

Acknowledged, do you have a gmane link or something to the Git mailing list that you could link here?

@psharpNumerex

This comment has been minimized.

Copy link

psharpNumerex commented Apr 22, 2015

http://thread.gmane.org/gmane.comp.version-control.git/267592

(Edit: updated to reference the specific thread)

@psharpNumerex

This comment has been minimized.

Copy link

psharpNumerex commented Apr 22, 2015

I'm not sure that git is going to do anything with this as their recommendation is to modify your local .ssh/config file.

@leehambley

This comment has been minimized.

Copy link
Member

leehambley commented Jul 6, 2015

Closing the issue as git versions supporting GIT_SSH_COMMAND are not really prevalent enough yet.

@leehambley leehambley closed this Jul 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment