https 访问
仅为 github.com 设置 socks5 代理 (推荐这种方式, 公司内网就不用设代理了, 多此一举):git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
其中 1086 是 socks5 的监听端口, 这个可以配置的, 每个人不同, 在 macOS 上一般为 1086.
设置完成后, ~/.gitconfig 文件中会增加以下条目:[http "https://github.com"] proxy = socks5://127.0.0.1:1086ssh 访问
需要修改~/.ssh/config 文件, 没有的话新建一个. 同样仅为 github.com 设置代理:Host github.com User git ProxyCommand nc -v -x 127.0.0.1:1086 %h %p如果是在 Windows 下, 则需要个性 %home%.ssh\config, 其中内容类似于:
Host github.com User git ProxyCommand connect -S 127.0.0.1:1086 %h %p这里 -S 表示使用 socks5 代理, 如果是 http 代理则为 -H. connect 工具 git 自带, 在
\mingw64\bin\ 下面.