我尝试使用这些说明为git(git协议,而不是https)设置代理。无论代理程序实际上是否在运行,Git似乎都可以正常工作,这使我相信它实际上根本没有使用代理程序,并且默默地“失败了”。
我对配置进行了尝试,试图找出正在发生的事情,如下所示。
$ git config --global core.gitProxy 'touch /tmp/test'
$ unset GIT_PROXY_COMMAND
$ git ls-remote git@github.com:redacted/redacted.git
...
$ file /tmp/test
/tmp/test: ERROR: cannot open `/tmp/test' (No such file or directory)
$ git --version
git version 1.8.3.2
Run Code Online (Sandbox Code Playgroud)
如何使代理正常工作,并确保其正常工作?我怎样才能使其“关闭失败”?
像往常一样,问题在于我自己的问题中的假设。事实证明,该git@github.com:redacted/redacted语法不使用git协议,而是使用ssh协议。所以我需要将代理配置为ssh的一部分,而不是git。一种(丑陋的)方式是这样的:
$ echo 'ProxyCommand touch /tmp/test' > ~/.ssh/config
$ git ls-remote git@github.com:redacted/redacted.git
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ file /tmp/test
/tmp/test: empty
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1578 次 |
| 最近记录: |