gpt4 book ai didi

git - core.gitProxy 和 GIT_PROXY_COMMAND 似乎什么都不做

转载 作者:太空狗 更新时间:2023-10-29 13:55:37 26 4
gpt4 key购买 nike

我尝试使用 these instructions 为 git(git 协议(protocol),而不是 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

如何让代理工作,并确保它正常工作?我怎样才能让它“失败关闭”?

最佳答案

像往常一样,问题在于我自己问题中的假设。事实证明,git@github.com:redacted/redacted语法使用git协议(protocol),它使用ssh协议(protocol)。所以我需要将代理配置为 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

关于git - core.gitProxy 和 GIT_PROXY_COMMAND 似乎什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28134405/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com