admin管理员组文章数量:1794759
terminal, git代理设置
因为某些众所周知的原因,需要设置代理访问某些网址。终端的设置和git的设置稍有不同。
1. Mac代理设置
打开.bash_profile文件
vi .bash_profile
将如下内容复制到文件末尾:
function proxy_off(){unset http_proxyunset https_proxyunset ftp_proxyunset rsync_proxyecho -e "已关闭代理"curl cip
}function proxy_on() {export no_proxy="localhost,127.0.0.1,localaddress,.localdomain"export http_proxy="http://127.0.0.1:19180"export https_proxy=$http_proxyexport ftp_proxy=$http_proxyexport rsync_proxy=$http_proxyexport HTTP_PROXY=$http_proxyexport HTTPS_PROXY=$http_proxyexport FTP_PROXY=$http_proxyexport RSYNC_PROXY=$http_proxyecho -e "已开启代理"curl cip
}
其中,19180是代理端口。然后配置生效
source .bash_profile
开启代理
AdministratordeMacBook-Air:ios administrator$ proxy_on
已开启代理
IP : 172.104.78.245
地址 : 日本 东京都 品川区
运营商 : linode数据二 : 日本东京都品川区 | Linode数据三 : 日本东京都东京URL : .104.78.245
AdministratordeMacBook-Air:ios administrator$
关闭代理命令:proxy_off
2. git代理设置
git设置代理就比较简单了:
git config --global http.proxy http://127.0.0.1:19180
git config --global https.proxy https://127.0.0.1:19180
其中,19180为代理端口。
取消代理如下:
git config --global --unset http.proxy
git config --global --unset https.proxy
版权声明:本文标题:terminal, git代理设置 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1695619952a313213.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论