fix(git): respect GIT_SSH_COMMAND
and GIT_SSH
#4381
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
At present, berry does not respect the
GIT_SSH_COMMAND
orGIT_SSH
environment variables, nor the.gitignore
file'score.sshCommand
setting. In the original issue, this prevented a user from usingplink
instead ofssh
, and I found the issue when I tried (and failed) to override whichssh
command I wished to use on windows.(Partially) Resolves #3271.
...
How did you fix it?
git
's behavior around the two environment variables is as follows:GIT_SSH_COMMAND
is set, treat that variable as a full command (including flags) to be run in place ofssh
GIT_SSH
is set, treat that variable as the path to the executable to use in place ofssh
. It is not expected to include flags.As such, the straightforward fix for berry seems to be:
GIT_SSH_COMMAND
is set, use that in place of the existing command.GIT_SSH
is set, replace thessh
in the existing command with the value ofGIT_SSH
.Checking the
.gitignore
file would be ideal, but more involved, and respecting the environment variables at least provides a method for the user to force their own command in place of the standard.Checklist