版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/scylhy/article/details/83508051
终端代理以及git加速
-
需求
在终端clone代码下载墙外的文件,需要加速或者代理
-
终端代理(mac、linux)
- 配置privoxy
#安装privoxy(见网络) #配置config,在/usr/local/etc/privoxy/config 加上如下内容 listen-address 0.0.0.0:8118 forward-socks5 / localhost:1080 .
-
终端启动代理
在.bashrc/.bash_profile上添加如下内容
startvpn(){ sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config export http_proxy='http://127.0.0.1:8118' export https_proxy='http://127.0.0.1:8118' echo "设置代理" } stopvpn(){ unset http_proxy unset https_proxy echo "取消代理" }
- 启动代理
localhost:~ liu$ startvpn localhost:~ liu$ startvpn Password: 设置代理 localhost:~ liu$ curl ip.gs Current IP / 当前 IP: 172.247.33.133 ISP / 运营商: fncloud.net cloudradium.com City / 城市: Los Angeles California Country / 国家: United States IP.GS is now IP.SB, please visit https://ip.sb/ for more information. / IP.GS 已更改为 IP.SB ,请访问 https://ip.sb/ 获取更详细 IP 信息! Please join Telegram group https://t.me/sbfans if you have any issues. / 如有问题,请加入 Telegram 群 https://t.me/sbfans /\_/\ =( °w° )= ) ( // (__ __)// localhost:~ liu$ stopvpn 取消代理 localhost:~ liu$
-
git加速
- 通过git命令配置,配置的内容,会加入到.gitconfig文件中
#启动git代理,命令方式 git config --global http.proxy socks5://127.0.0.1:1080 git config --global http.proxy socks5://127.0.0.1:1080 #.gitconfig 或者直接修改.gitconfig文件 localhost:~ liu$ cat .gitconfig [http] postBuffer = 524288000 proxy = socks5://127.0.0.1:1080 [https "https://github.com"] proxy = socks5://127.0.0.1:1080
- status 下载速度从30k到900k
localhost:~ liu$ git clone https://github.com/hyperledger/fabric.git Cloning into 'fabric'... remote: Enumerating objects: 37, done. remote: Counting objects: 100% (37/37), done. remote: Compressing objects: 100% (28/28), done. ceiving objects: 15% (11958/79719), 4.57 MiB | 948.00 KiB/s localhost:~ liu$