【发布时间】:2020-01-01 09:45:33
【问题描述】:
我使用以下命令设置代理
$ 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
但是当我克隆一个 repo 时,比如
# 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"
但还是不行。
【问题讨论】: