2 篇文章带有标签 “config”

git 配置代理

我使用 v2ray 科学上网,并且已经开启了全局模式,所有网络连接都应该通过 v2ray 的代理服务器。但我使用 git 命令行应用发现不能连接 GitHub,但 GitHub Desktop 可以正常使用。

git clone https://github.com/wang-junjian/chatbox
Cloning into 'chatbox'...
fatal: unable to access 'https://github.com/wang-junjian/chatbox/': Failed to connect to github.com port 443 after 75011 ms: Couldn't connect to server

在这种情况下,你需要手动为 git 设置代理。

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

这些命令将 git 的 HTTP 和 HTTPS 代理设置为 socks5://127.0.0.1:1080。你需要将 1080 替换为你的 v2ray 服务的端口。