在Vim中安装插件时,一般是需要访问github来安装的,但是github经常不能访问,所以需要设置代理来访问。
两条命令分别设置git的http和https的代理,如下:
git config --global http.proxy http://192.168.1.129:1880
git config --global https.proxy http://192.168.1.129:1880
语法:
git config --global http.proxy http://<proxy_address>:<proxy_port>
git config --global http.proxys http://<proxy_address>:<proxy_port>
这个答案直接问ChatGPT就有了,爽!
取消代理:
git config --global --unset http.proxy
git config --global --unset https.proxy
设置整个系统的代理:
用vim打开:~/.bashrc文件,在末尾添加:
export http_proxy=http://<your_proxy_address>:<your_proxy_port>
export https_proxy=http://<your_proxy_address>:<your_proxy_port>
export ftp_proxy=http://<your_proxy_address>:<your_proxy_port>
然后执行:source %
退出vim即可。
你可以运行以下命令来验证代理是否已正确设置:
echo $http_proxy
echo $https_proxy
echo $ftp_proxy
如果一切设置正确,这些命令应该显示你所配置的代理地址和端口。