forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_proxy.sh
executable file
·47 lines (37 loc) · 964 Bytes
/
git_proxy.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/zsh
set_proxy() {
echo "Setting Git proxy... to the system proxy"
echo "http_proxy=$http_proxy"
echo "https_proxy=$https_proxy"
local proxy_host=$http_proxy
local proxy_port=$https_proxy
# Set the Git proxy configuration
git config --global http.proxy $http_proxy
git config --global https.proxy $http_proxy
echo "Git proxy set to $http_proxy"
}
unset_proxy() {
# Unset the Git proxy configuration
echo "Unsetting Git proxy..."
git config --global --unset http.proxy
git config --global --unset https.proxy
echo "Git proxy unset"
}
# Check the subcommand and execute the corresponding function
# optional arguments: <proxy_host> <proxy_port>
# case "$1" in
# set)
# if [[ $# -ne 3 ]]; then
# echo "Usage: $0 set <proxy_host> <proxy_port>"
# exit 1
# fi
# set_proxy "$2" "$3"
# ;;
# unset)
# unset_proxy
# ;;
# *)
# echo "Usage: $0 <set|unset>"
# exit 1
# ;;
# esac