websoft9/scripts/git_proxy.sh

24 lines
431 B
Bash
Raw Normal View History

2022-12-30 02:40:17 +00:00
#!/bin/bash
#repo=$1
#path=$2
2022-12-30 03:25:22 +00:00
url_path=(
https://ghproxy.com/https://github.com
https://github.com)
2022-12-30 02:40:17 +00:00
git_clone(){
for r in ${1[*]}
do
filename=$(echo $r | cut -d '/' -f 2)
2022-12-30 03:25:22 +00:00
for x in ${url_path[*]}
2022-12-30 02:40:17 +00:00
do
if [ -e $filename ]; then
echo "$filename was cloned successfully"
break
else
timeout -k 1 3 git clone $x/$r.git
fi
done
done
}
git_clone