HTTP HTTPS Socket

如果可以更推荐用 socket 作为 git 代理,在最新版本 clash verge,用 http 经常又 https 证书问题

git 设置代理

git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

# 其他端口自行设定
git config --global http.proxy 127.0.0.1:7891
git config --global https.proxy 127.0.0.1:7891

7890 是我们代理软件的端口。

socket5 代理

# 查看
git config --list
# 编辑
git config --global -e

git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'

git 不想使用代理的时候

git config --global --unset http.proxy
git config --global --unset https.proxy

git 查看正在使用的代理

git config --global --get http.proxy
git config --global --get https.proxy

SSH

1.Windows下

修改C:\\Users\\${your username}\\.ssh目录下的config文件,若没有则新建

Host github.com                                                                                                          
        Hostname ssh.github.com                                                                                          
        Port 443                                                                                                         
        User git
        ProxyCommand connect -S 127.0.0.1:7890 %h %p

2.类Unix系统

例如Linux、MacOS、Windows的Wsl2等等

修改~/.ssh目录下的config文件,若没有则新建