Skip to content

Instantly share code, notes, and snippets.

@laispace
Last active June 2, 2025 14:58
Show Gist options
  • Save laispace/666dd7b27e9116faece6 to your computer and use it in GitHub Desktop.
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
@zx0316
Copy link

zx0316 commented Mar 13, 2025

mac下 梯子ClashX 执行
git config --global http.https://git.521000.best.proxy socks5://127.0.0.1:7890

设置完成后, ~/.gitconfig文件中会增加以下条目:
[http "https://github.com"]
proxy = socks5://127.0.0.1:7890

再用https方式下载,会走梯子, 亲测有效!

@taoliujun
Copy link

taoliujun commented Apr 14, 2025

mac下,仅仅设置 ~/.ssh/config 即可:

Host github.com
    User git
    ProxyCommand nc -v -x 127.0.0.1:7890 %h %p

@somewheve
Copy link

如果那个命令不管用 我推荐使用管理员权限打开cmd再设置代理 win11 亲测有效

@mccreexu
Copy link

目前在 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://git.521000.best.proxy socks5://127.0.0.1:7890

参考了 @xpalive 的方式,SSH 还得看完全文

我的clash端口是7897,非常好使,甚至都不用改~/.ssh/config文件

@mccreexu
Copy link

目前在 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://git.521000.best.proxy socks5://127.0.0.1:7890

参考了 @xpalive 的方式,SSH 还得看完全文

我的clash端口是7897,非常好使,甚至都不用改~/.ssh/config文件

但是只对 github.com 进行代理用这个写法没生效,期待其他大神解答

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment