Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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
为什么我的git代理配置不起作用?I';我相信我';我已经正确地设置了它,但它仍然没有';行不通_Git_Proxy - Fatal编程技术网

为什么我的git代理配置不起作用?I';我相信我';我已经正确地设置了它,但它仍然没有';行不通

为什么我的git代理配置不起作用?I';我相信我';我已经正确地设置了它,但它仍然没有';行不通,git,proxy,Git,Proxy,我使用以下命令设置代理 $ git config --global git.proxy http://127.0.0.1:1080 $ git config --global http.proxy http://127.0.0.1:1080 $ git config --global https.proxy http://127.0.0.1:1080 但当我克隆回购协议时,例如 # git clone git@github.com:npm/npm.git 它不使用代理进行克隆 我试图更改我

我使用以下命令设置代理

$ git config --global git.proxy http://127.0.0.1:1080
$ git config --global http.proxy http://127.0.0.1:1080
$ git config --global https.proxy http://127.0.0.1:1080

但当我克隆回购协议时,例如

# git clone git@github.com:npm/npm.git
它不使用代理进行克隆

我试图更改我的代理地址,它是随机地址

$ git config --global git.proxy asdfi:sidfw:sfd
$ git config --global http.proxy asdfi:sidfw:sfd
$ git config --global https.proxy asdfi:sidfw:sfd

如果代理可以工作,git应该会提示一些错误。 但是当我再次克隆时,它没有提示任何错误

$ git clone git@github.com:s97712/protobuf.js.git
Cloning into 'protobuf.js'...
Enter passphrase for key '/home/s97712/.ssh/id_rsa': 
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
Receiving objects:   2% (363/18110), 60.00 KiB | 5.00 KiB/s
这意味着git代理无法工作

我还尝试使用环境变量

$ export http_proxy="http://localhost:1080"
$ export https_proxy="http://localhost:1080"
但它仍然不起作用

git clone git@github.com:…
这是SSH协议(类似于scp的URL语法),它不使用HTTP代理。要使用代理服务器,请将URL更改为HTTPS:

git clone https://github.com:…
PS.端口1080表明它是SOCKS代理,而不是HTTP代理。如果是,我认为代理语法是不同的。见和

这是SSH协议(类似于scp的URL语法),它不使用HTTP代理。要使用代理服务器,请将URL更改为HTTPS:

git clone https://github.com:…

PS.端口1080表明它是SOCKS代理,而不是HTTP代理。如果是,我认为代理语法是不同的。请参阅和。

我通过socks5(
ssh
)代理将连接代理到github.com

i、 e.
ssh-C-D 1080user@host-f-N
ssh
socks5在后台通过主机代理,没有默认命令和压缩功能)。github.com的My
~/.ssh/config
如下所示:

Host github.com
    ProxyCommand /bin/nc -X 5 -x 127.0.0.1:1080 %h %p

我通过socks5(
ssh
)代理连接github.com

i、 e.
ssh-C-D 1080user@host-f-N
ssh
socks5在后台通过主机代理,没有默认命令和压缩功能)。github.com的My
~/.ssh/config
如下所示:

Host github.com
    ProxyCommand /bin/nc -X 5 -x 127.0.0.1:1080 %h %p

git config——全局git.proxyhttp://127.0.0.1:1080
无法在
git@github.com:…
?我的代理地址“http://127.0.0.1:1080”可以在wget或curl上工作,但不能在git上工作。
wget
curl
使用http协议,
git克隆git@github.com:…
使用SSH协议,SSH协议不使用HTTP代理,明白吗?要使用代理,请将URL更改为HTTPs。
git config--global git.proxyhttp://127.0.0.1:1080
无法在
git@github.com:…
?我的代理地址“http://127.0.0.1:1080”可以在wget或curl上工作,但不能在git上工作。
wget
curl
使用http协议,
git克隆git@github.com:…
使用SSH协议,SSH协议不使用HTTP代理,明白吗?若要使用代理,请将URL更改为HTTPs。