成功解决 git设置代理, github克隆速度大幅提升

welcome to my blog

问题:在windows10下使用git clone速度太慢了, 需要使用代理提速; Linux下有类似的步骤, 但是细节不同, 具体可以参考这篇文章的Unix代理部分

协议选择: 克隆时可以选择https协议, 也可以选择ssh协议, 我使用ssh协议

在这里插入图片描述

在.ssh目录下创建config文件, .ssh目录在windows的用户目录下如C:\Users\Hinata\.ssh,然后填写如下内容保存退出, 注意替换两处用户名

ProxyCommand connect.exe -S 127.0.0.1:1080 %h %p

Host github.com
  User git
  Port 22
  Hostname github.com
  # 注意将用户名替换成自己的
  IdentityFile "C:\Users\Hinata\.ssh\id_rsa"
  TCPKeepAlive yes
  IdentitiesOnly yes

Host ssh.github.com
  User git
  Port 443
  Hostname ssh.github.com
  # 注意将用户名替换成自己的
  IdentityFile "C:\Users\Hinata\.ssh\id_rsa"
  TCPKeepAlive yes
  IdentitiesOnly yes

现在的克隆速度快多了!

在这里插入图片描述

犯了个愚蠢的错误, 克隆一个仓库时,没看到用的是https协议, 我还奇怪为什么就不能加速了。。。再此让我认识到,这个设置仅对ssh协议有效,蠢哭了

发布了489 篇原创文章 · 获赞 101 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/littlehaes/article/details/103446835