使用ssh时使用git客户端发送环境变量
我希望能够在调用时发送一个环境变量,例如git clone over ssh: git克隆ssh://host.example/project 我知道这可以通过为host.example在~/.ssh/config中设置SendEnv来实现。尽管我希望避免修改任何文件。例如,仅使用ssh我们就可以做到: ssh-o SendEnv=MYVAR server.example.com mycommand 并且不需要修改文件。在ssh上使用git clone时,是否有类似的方法来实现这一点使用ssh时使用git客户端发送环境变量,git,ssh,environment-variables,Git,Ssh,Environment Variables,我希望能够在调用时发送一个环境变量,例如git clone over ssh: git克隆ssh://host.example/project 我知道这可以通过为host.example在~/.ssh/config中设置SendEnv来实现。尽管我希望避免修改任何文件。例如,仅使用ssh我们就可以做到: ssh-o SendEnv=MYVAR server.example.com mycommand 并且不需要修改文件。在ssh上使用git clone时,是否有类似的方法来实现这一点 干杯 Ba
干杯 Bash shell函数可以执行以下操作:
function e { echo $1; GIT_SSH=$1; export GIT_SSH; }
用“echo$1”替换您需要的任何Git功能