-
Star
(1,241)
You must be signed in to star a gist -
Fork
(279)
You must be signed in to fork a gist
-
-
Save laispace/666dd7b27e9116faece6 to your computer and use it in GitHub Desktop.
| git config --global https.proxy http://127.0.0.1:1080 | |
| git config --global https.proxy https://127.0.0.1:1080 | |
| git config --global --unset http.proxy | |
| git config --global --unset https.proxy | |
| npm config delete proxy |
mac下,仅仅设置 ~/.ssh/config 即可:
Host github.com
User git
ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
如果那个命令不管用 我推荐使用管理员权限打开cmd再设置代理 win11 亲测有效
目前在 Windows 10 上使用 Clash
git config --global http.proxy socks5://127.0.0.1:7890 git config --global https.proxy socks5://127.0.0.1:7890如果只想对某个地址进行代理,比如对
github.com代理,就这样:git config --global http.https://github.com.proxy socks5://127.0.0.1:7890参考了 @xpalive 的方式,SSH 还得看完全文
我的clash端口是7897,非常好使,甚至都不用改~/.ssh/config文件
目前在 Windows 10 上使用 Clash
git config --global http.proxy socks5://127.0.0.1:7890 git config --global https.proxy socks5://127.0.0.1:7890如果只想对某个地址进行代理,比如对
github.com代理,就这样:git config --global http.https://github.com.proxy socks5://127.0.0.1:7890参考了 @xpalive 的方式,SSH 还得看完全文
我的clash端口是7897,非常好使,甚至都不用改~/.ssh/config文件
但是只对 github.com 进行代理用这个写法没生效,期待其他大神解答
mac上的情况如楼上老哥说的,开着梯子的话得改成443端口,或者是关了梯子直连就可以正常push和clone了。问了ai,原理大概就是梯子干扰了SSH协议
win10系统,结合前面几位老哥的,在config文件中加入这几句: Host github.com User git ProxyCommand connect -S 127.0.0.1:7891 %h %p
测试有效,我也用是的Clash,最开始打开System Proxy(系统全局代理)都没用。 我的git不知道什么版本的,config文件的路径是C:\Program Files\Git\etc\ssh\ssh_config,用记事本打开然后加上上面三句就可以了,注意改一下端口跟你clash中的端口一致,我的是7891
感谢大佬。之前一直写在C:\Users\用户名.ssh\config 里没用,按照你的方式改git目录下的ssh_config,成功让git走代理了。
只是还是不明白,无论怎么设置http proxy ,git操作时观测梯子流量始终没动,git速度也慢,git死活不走梯子。
mac下 梯子ClashX 执行
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
再用https方式下载,会走梯子, 亲测有效!