关于Git(一):贡献个一键打开关闭git socks5代理的脚本

来源:互联网 发布:网络上骰宝赢钱技巧 编辑:程序博客网 时间:2024/06/06 03:34

背景:自从两年前开始注意收集Git方面的使用点滴以来,已经大大小小积累了十几个注意事项,本想集中起来写篇Git使用手册,无奈一直抽不出时间。索性把每个点单独写出。本文贡献一个一键打开socks5代理的方法:

#!/bin/bashcase $1 inon)git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:1080';;off)git config --global --unset http.proxygit config --global --unset https.proxy;;status)git config --get http.proxygit config --get https.proxy;;esacexit 0

将上述文件保存为gitproxy,注意不要带任何后缀,将其复制到/usr/local/bin,增加可执行权限即可。

使用说明

打开socks5代理

gitproxy on

关闭socks5代理

gitproxy off

查看socks5状态

gitproxy status

注意事项

1.请保证shadowsocks5的本地端口为1080并打开,如果端口为其他,请对应修改脚本.

2.通过which gitproxy检测脚本是否放对地方.

1 0
原创粉丝点击