参考 https://www.jianshu.com/p/33d72b87452d
我有个黑科技办法
参考
core.sshCommand If this variable is set, git fetch and git push will use the specified command instead of ssh when they need to connect to a remote system. The command is in the same form as the GIT_SSH_COMMAND environment variable and is overridden when the environment variable is set.
首先需要确认 git remote -v 是不是ssh连接
然后执行
git config --local --add core.sshCommand 'ssh -i /path/to/private'
之后就可以使用定制的私钥位置访问了
或者残暴点
GIT_SSH_COMMAND='ssh -i private_key_file' git pull
网友评论