一旦工作,那就要努力的干,聪明的干,快速的干——用省下来的时间干自己喜欢干的事情。!

github拉代码慢的解决方案(mac/windows)

linux lampnick 641℃ 0评论

https 访问 github

git config --global http.https://github.com.proxy socks5://127.0.0.1:7890
上面命令运行完成后,在  ~/.gitconfig 文件中会增加以下条目:
[http "https://github.com"]
    proxy = socks5://127.0.0.1:7890
取消代理
git config --global --unset http.https://github.com.proxy

ssh 方式访问 github

  • mac 设置方式
    需要修改 ~/.ssh/config 文件,没有的话新建一个,同样仅为 github.com 设置代理:
    Host github.com
    User git
    ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
  • windows 设置方式
    # 如果是在 Windows 下, 则需要个性 %home%.ssh\config , 其中内容类似于:
    Host github.com
    User git
    ProxyCommand connect -S 127.0.0.1:7890 %h %p
    这里-S表示使用socks5代理, 如果是http代理则为-H. connect工具git自带, 在\mingw64\bin\下面.

    以上 7890 需要修改为你本地的 socks5 的端口
    参考:https://gist.github.com/laispace/666dd7b27e9116faece6

转载请注明:MitNick » github拉代码慢的解决方案(mac/windows)

喜欢 (59)or分享 (0)
头像
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址