-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproxy.sh
More file actions
31 lines (26 loc) · 762 Bytes
/
proxy.sh
File metadata and controls
31 lines (26 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
sed -i "/proxy\=/d" $HOME/.bashrc
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config rm proxy
npm config rm https-proxy
if [ -z "$1" ]
then
proxy=172.31.2.3
else
if [ $1 -eq 0 ]
then
source $HOME/.bashrc
exit
else
proxy="172.31.2.$1"
fi
fi
echo "http_proxy=\"http://${proxy}:8080\"" >> $HOME/.bashrc
echo "https_proxy=\"https://${proxy}:8080\"" >> $HOME/.bashrc
echo "ftp_proxy=\"ftp://${proxy}:8080\"" >> $HOME/.bashrc
git config --global http.proxy "http://${proxy}:8080"
git config --global https.proxy "https://${proxy}:8080"
npm config set proxy "http://${proxy}:8080"
npm config set https-proxy "https://${proxy}:8080"
source $HOME/.bashrc