windows 设置代理 http || https协议 //设置全局代理 //http git config --global https.proxy :7891 //https git config --global https.proxy https://127.0.0.1:7891 // socks git config --global http.proxy socks5://127.0.0.1:7891 git config --global https.proxy socks5://127.0.0.1:7891 //只对github.com使用代理,欧博其他仓库不走代理 git config --global http.https://github.com.proxy socks5://127.0.0.1:7891 git config --global https.https://github.com.proxy socks5://127.0.0.1:7891 //取消github代理 git config --global --unset http.https://github.com.proxy git config --global --unset https.https://github.com.proxy //取消全局代理 git config --global --unset http.proxy git config --global --unset https.proxy SSH协议 //对于使用git@协议的,皇冠可以配置socks5代理 //在~/.ssh/config 文件后面添加几行,DG游戏没有可以新建一个 //socks5 Host github.com User git ProxyCommand connect -S 127.0.0.1:7891 %h %p //http || https Host github.com User git ProxyCommand connect -H 127.0.0.1:7891 %h %p WSL2设置代理 在 Ubuntu 子系统中,欧博注册通过 cat /etc/resolv.conf 查看 DNS 服务器 IP cat /etc/resolv.conf # This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf: # [network] # generateResolvConf = false nameserver 172.23.64.1其实上面地址就是windows下面这个ip地址 我们要为WSL配置ssh代理和http代理 touch ~/.ssh/config vim ~/.ssh/config Host github.com HostName github.com User git # 走 socks5 代理 ProxyCommand nc -v -x 172.28.32.1:7891 %h %p使用下面命令检查ssh代理配置是否成功 ssh -T github.com Connection to github.com 22 port [tcp/ssh] succeeded! Hi wq-zhijun! You've successfully authenticated, but GitHub does not provide shell access.可以将上面ip地址配置代理写入到.bashrc文件中,欧博代理这样就可以自己用户开机永久生效, 7891端口是clash for windows端口,另外将Allow LAN打开。 还需要将防火墙打开 原因是有的节点22端口被服务端封锁了,要么改服务端端口要么改自己本地更换443端口(~/.ssh/config)) # 可以先使用如下测试下 ssh -T -p 443 git@ssh.github.com # Hi USERNAME! You've successfully authenticated, but GitHub does not # provide shell access. # 更换端口后再测试下 ssh -T git@github.com # Hi USERNAME! You've successfully authenticated, but GitHub does not # provide shell access. # .ssh目录的config文件添加如下内容 vim ~/.ssh/config Host github.com HostName github.com User git # set socks5 proxy ProxyCommand nc -v -x 172.23.64.1:7891 %h %p 参考链接Git设置代理 |