1 Star 0 Fork 1

xianyun/Ubuntu-config

forked from 李拓/Ubuntu-config 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
proxy-ubuntu.sh 862 Bytes
一键复制 编辑 原始数据 按行查看 历史
lituo 提交于 2021-04-28 10:55 . chong ming ming
#!/bin/sh
hostip=192.168.123.119
port=63323
PROXY_HTTP="http://${hostip}:${port}"
set_proxy(){
export http_proxy="${PROXY_HTTP}"
export HTTP_PROXY="${PROXY_HTTP}"
export https_proxy="${PROXY_HTTP}"
export HTTPS_proxy="${PROXY_HTTP}"
export all_proxy="socks5://${hostip}:${port}"
git config --global http.proxy "${PROXY_HTTP}"
git config --global https.proxy "${PROXY_HTTP}"
}
unset_proxy(){
unset http_proxy
unset HTTP_PROXY
unset https_proxy
unset HTTPS_PROXY
git config --global --unset http.proxy
git config --global --unset https.proxy
}
test_setting(){
echo "Host ip:" ${hostip}
echo "Current proxy:" $https_proxy
}
if [ "$1" = "set" ]
then
set_proxy
elif [ "$1" = "unset" ]
then
unset_proxy
elif [ "$1" = "test" ]
then
test_setting
else
echo "Unsupported arguments."
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/linux-git/ubuntu-config.git
git@gitee.com:linux-git/ubuntu-config.git
linux-git
ubuntu-config
Ubuntu-config
master

搜索帮助