为github添加代理(windows)
以下内容均在windows环境下使用
设置https代理
在git窗口复制粘贴下面命令(https://github.com/Fndroid/clash_for_windows_pkg)
clash默认端口是7890
git config --global https.proxy socks5://127.0.0.1:代理端口
取消https代理
git config --global --unset https.proxy
查看https代理
git config --global --get https.proxy
设置ssh代理
- 找到自己的git配置文件
C:\Users\用户名\.ssh\config
复制粘贴下面内容到config文件
Host github.com
Hostname ssh.github.com
IdentityFile /c/users/xxx/.ssh/id_rsa
User git
Port 443
ProxyCommand "D:\Git\mingw64\bin\connect.exe" -S 127.0.0.1:代理端口 %h %p
修改内容:
- 将 IdentityFile后面的 /c/users/用户名/.ssh/id_rsa改为自己id_rsa文件路径,格式不要变。
- 将ProxyCommand 后面的 "D:\Git\mingw64\bin\connect.exe" 改为自己的connect.exe路径,一般在git的安装目录下的mingw64\bin文件夹内
- 代理端口设为自己的
取消ssh代理
清空config文件的内容
测试clone速度
大小约为500MB
ssh:git clone git@github.com:singgel/JAVA.git
https:git clone https://github.com/singgel/JAVA.git
对比结果
加速前
$ git clone git@github.com:singgel/JAVA.git
Cloning into 'JAVA'...
remote: Enumerating objects: 217, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (54/54), done.
Receiving objects: 10% (22/217), 332.00 KiB | 75.00 KiB/s
加速后
$ git clone git@github.com:singgel/JAVA.git
Cloning into 'JAVA'...
remote: Enumerating objects: 217, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (54/54), done.
client_loop: send disconnect: Broken pipeiB | 2.94 MiB/s
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)