7 Star 1 Fork 6

zengchen1024 / repo-test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
clone.sh 503 Bytes
一键复制 编辑 原始数据 按行查看 历史
zengchen1024h 提交于 2022-06-17 15:08 . fix 1
#!/bin/sh
clone_code() {
local url=$1
local dir=$2
local branch=$3
test -n "$branch" && branch="-b $branch"
local msg=""
for i in {1..3}; do
test -d $dir && rm -fr $dir
mkdir $dir
msg=$(git clone $branch $url $dir)
test $? -eq 0 && return 0
if [ $i -eq 3 ]; then
msg="clone failed for 3 times"
return 1
fi
sleep $((RANDOM%15+5))
done
echo $msg
return 1
}
clone_code $1 $2 $3
1
https://gitee.com/zengchen1024/repo-test.git
git@gitee.com:zengchen1024/repo-test.git
zengchen1024
repo-test
repo-test
master

搜索帮助