终端设置代理

起因

由于之前git clone或者类似操作经常出现问题,但我本身开了代理的,所以不知道出了什么问题,后面才知道需要另外设置代理,这里总结一下不同平台终端开启代理方式。

image-20230514151726235

git bash

设置代理,注意端口号是你代理软件的端口

git config --global http.proxy http://127.0.0.1:9080
git config --global https.proxy https://127.0.0.1:9080

如果是其他协议,直接更改后面的值即可http.proxyhttps.proxy

重置代理

git config --global --unset http.proxy
git config --global --unset https.proxy

Windows powershell

$env:HTTP_PROXY="http://127.0.0.1:9080"
$env:HTTPS_PROXY="https://127.0.0.1:9080" 

Windows CMD

set http_proxy=http://127.0.0.1:9080
set https_proxy=http://127.0.0.1:9080

MAC iterm2

export http_proxy=http://127.0.0.1:9080
export https_proxy=$http_proxy

重置代理

unset http_proxy https_proxy

本文由mdnice多平台发布

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容