-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_git_proxy.sh
More file actions
34 lines (29 loc) · 769 Bytes
/
set_git_proxy.sh
File metadata and controls
34 lines (29 loc) · 769 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
32
33
34
#!/bin/sh
PROXY_SERVER=$1
if [ -z "$PROXY_SERVER" ]; then
echo "Usage: $0 <proxy_server>"
exit 1
fi
# $1 is "clear"
if [ "$PROXY_SERVER" = "clear" ]; then
git config --global --unset http.proxy
git config --global --unset https.proxy
echo "Cleared http and https proxy"
exit 0
fi
# http
return=`git config --global --get http.proxy`
if [ -z "$return" ]; then
git config --global http.proxy $PROXY_SERVER
echo "Set http proxy to $PROXY_SERVER"
else
echo "Http proxy is already set to $return"
fi
# https
return=`git config --global --get https.proxy`
if [ -z "$return" ]; then
git config --global https.proxy $PROXY_SERVER
echo "Set https proxy to $PROXY_SERVER"
else
echo "Https proxy is already set to $return"
fi