Open monsterooo opened 5 years ago
找到代理地址:127.0.0.1:50880
修改~/.bash_profile配置文件入下:
# proxy export http_proxy=http://127.0.0.1:50880 export https_proxy=$http_proxy
如果不存在 ~/.bash_profile 则新建一个
执行 source 命令让配置文件立刻生效,source ~/.bash_profile
source ~/.bash_profile
测试是否链接 curl -i https://google.com
curl -i https://google.com
以上设置只针对http(s)的协议,如果clone的git仓库地址是git协议开头的,则无法使用代理速度还是非常非常的慢(6k~12k)。
配置代理后的效果:
这个时候需要配置ssh的代理(git协议是特殊的协议它走的是ssh的通道)
具体配置ssh的方法:
编辑 ~/.ssh/config,没有则创建一个
~/.ssh/config
Host github.com User git ProxyCommand /usr/bin/nc -X 5 -x <socks_host>:<socks_port> %h %p
git特殊协议代理方法(我测试无效)
配置git配置(~/.gitconfig)
[core] gitproxy = /path/to/gitproxy for github.com
或使用命令更新git配置项:git config --global core.gitproxy "/path/to/gitproxy for github.com"
git config --global core.gitproxy "/path/to/gitproxy for github.com"
代理脚本:
#!/bin/sh # # Proxy wrapper for git protocol (9418). # # git config --global core.gitproxy "ido gitproxy" # exec /usr/bin/nc -X 5 -x <socks_host>:<socks_port> $1 $2
参考来源:https://yechengfu.com/blog/2015/01/16/use-git-behind-proxy/
iTerm2终端配置代理
找到代理地址:127.0.0.1:50880
修改~/.bash_profile配置文件入下:
如果不存在 ~/.bash_profile 则新建一个
执行 source 命令让配置文件立刻生效,
source ~/.bash_profile
测试是否链接
curl -i https://google.com
ssh 代理
以上设置只针对http(s)的协议,如果clone的git仓库地址是git协议开头的,则无法使用代理速度还是非常非常的慢(6k~12k)。
配置代理后的效果:
这个时候需要配置ssh的代理(git协议是特殊的协议它走的是ssh的通道)
具体配置ssh的方法:
编辑
~/.ssh/config
,没有则创建一个git特殊协议代理方法(我测试无效)
配置git配置(~/.gitconfig)
或使用命令更新git配置项:
git config --global core.gitproxy "/path/to/gitproxy for github.com"
代理脚本:
参考来源:https://yechengfu.com/blog/2015/01/16/use-git-behind-proxy/