Git 的代理设置也非常简单,一句话就搞定了:
git config --global http://proxy.yourname.com:8080
如果需要用户名密码的话,则设置:
git config --global http.proxy http://user:password@proxy.yourname.com:8080
其中 user
和 password
分别为你的用户名和密码。
设置完成后,可以通过如下命令来查看设置是否生效:
git config --get --global http.proxy
如果某一天你不喜欢她了,需要删除代理设置,那么可以使用:
git config --system (或 --global 或 --local) --unset http.proxy
来删除设置。 有些童鞋可能使用的 Git 的客户端,比如界面很上流的 Github for Windows,里面可能并没有代理设置的选项,不过别着急,这些客户端一般在底层都是调用的命令行工具,所以同样按照上述步骤进行设置即可。
转自: http://higrid.net/c-art-proxy_setting_in_wincmd.htm#git-