Git通过设置代理进行访问

来源:互联网 发布:淮阴师范学院网络课程 编辑:程序博客网 时间:2024/05/17 02:29

1. 问题背景

近期由于”Wall”的原因, github不能下载代码, 如报以下错误:

daviddeMacBook-Pro:~ david$ git co https://github.com/liuwei0376/learngit.git
Cloning into ‘learngit’…
fatal: unable to access ‘https://github.com/liuwei0376/learngit.git/‘: Failed to connect to github.com port 443: Operation timed out

可以通过设置代理方式进行访问.

2. 需要对git设置以下两项全局变量:

http.proxy     用于http方式站点https.proxy    用于https方式资源站点http.sslverify 禁用ssl校验

3. 具体语法


git config --global http.proxy http://user:password@yyy.xxx.com:port
git config --global https.proxy http://user:password@yyy.xxx.com:port
git config --global http.sslverify false

4. 查看配置是否生效

执行完上述命令后, 你会发现, 这2条命令会以ini文件存储形式保存进
.gitconfig文件下:


[http]
proxy = http://user:password@yyy.xxx.com:port
sslverify = false
[https]
proxy = http://user:password@yyy.xxx.com:port

0 0
原创粉丝点击