Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ssh时使用git客户端发送环境变量_Git_Ssh_Environment Variables - Fatal编程技术网

使用ssh时使用git客户端发送环境变量

使用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

我希望能够在调用时发送一个环境变量,例如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时,是否有类似的方法来实现这一点


干杯

Bash shell函数可以执行以下操作:

function e { echo $1; GIT_SSH=$1; export GIT_SSH; }
用“echo$1”替换您需要的任何Git功能