在Gitconfig中设置GIT_SSH环境变量 [英] Set GIT_SSH Environment Variable in Gitconfig
问题描述
是否可以在gitconfig文件中设置GIT_SSH环境变量?
自我的2013年回答(Git 1.8.3.4 ),则设置了新的配置: core.sshCommand
如果设置了此变量,则在需要连接到远程系统时,
git fetch
和git push
将使用指定的命令而不是ssh
. 该命令与GIT_SSH_COMMAND
环境变量的格式相同,并且在设置环境变量时将被覆盖.
已在 Git 2.10,提交3c8ede3,2016年6月 >
从那时起,您 Git 2.13,提交dd33e077,2017年2月,其中具有 ssh.variant
根据环境变量
GIT_SSH
或GIT_SSH_COMMAND
的值或配置设置core.sshCommand
,Git自动检测是否调整其命令行参数以用于plink或tortoiseplink,而不是默认(OpenSSH).可以将配置变量
ssh.variant
设置为覆盖此自动检测; 有效值是ssh
,plink
,putty
或tortoiseplink
.
任何其他值将被视为普通ssh.可以通过环境变量GIT_SSH_VARIANT
覆盖此设置.
对于这些,我需要使用Git for Windows随附的SSH客户端
因此对于需要ssh而不是腻子的仓库,您可以使用这两种设置在您的配置中精确地设置 .
cd /path/to/my/repo
git config ssh.variant ssh
Is there a way to set the GIT_SSH environment variable in the gitconfig file?
Since my 2013 answer (Git 1.8.3.4), a new configuration has been set: core.sshCommand
If this variable is set,
git fetch
andgit push
will use the specified command instead ofssh
when they need to connect to a remote system.
The command is in the same form as theGIT_SSH_COMMAND
environment variable and is overridden when the environment variable is set.
It has been introduced in Git 2.10, commit 3c8ede3, June 2016
Since then, you have Git 2.13, commit dd33e077, Feb. 2017, which has ssh.variant
Depending on the value of the environment variables
GIT_SSH
orGIT_SSH_COMMAND
, or the config settingcore.sshCommand
, Git auto-detects whether to adjust its command-line parameters for use with plink or tortoiseplink, as opposed to the default (OpenSSH).The config variable
ssh.variant
can be set to override this auto-detection; valid values aressh
,plink
,putty
ortortoiseplink
.
Any other value will be treated as normal ssh. This setting can be overridden via the environment variableGIT_SSH_VARIANT
.
For those, I need to use the SSH client that Git for Windows came with
So for the repos where you need ssh instead of putty, you can use both settings to set exactly in your configuration what you want.
cd /path/to/my/repo
git config ssh.variant ssh
这篇关于在Gitconfig中设置GIT_SSH环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!