开源 企业版 高校版 私有云 模力方舟 AI 队友
let's ask me why
概览 仓库 Issues Pull Requests 动态 成员 4
自定义精选项目
最多可选取 6 个公开仓库
还能勾选 6
组织介绍

X-Hero

1. Quick Start


1.1. 设置个人SSH密钥

个人Settings -> SSH keys


1.2. 创建个人access token以便访问GitEE API

个人Settings -> Personal access tokens -> Generate new token


1.3. 针对隶属于X-Hero组织下所有仓库的clone程序

在你想要进行clone的目录下运行该程序,例如:

mkdir x-hero
cd x-hero
./x-hero-cap.sh YOUR-ACCESS-TOKEN

1.3.1. MacOS

程序内容:

#!/usr/bin/env bash

url_list=(`curl -X GET --header \
 'Content-Type: application/json;charset=UTF-8' \
 "https://gitee.com/api/v5/orgs/x-hero/repos?access_token=1ドル&type=private&page=1&per_page=30" \
 | egrep -o "full_name.*?," \
 | awk -F '/' '{print 2ドル}' \
 | awk -F '\"' '{print 1ドル}'`)

echo '---------------------------------------------------------------------'
for ((i=0;i<${#url_list[@]};i++)); do
echo "[ `expr $i + 1` / ${#url_list[@]} ]"
 if [ ! -d ${url_list[i]} ]; then
echo "${url_list[i]} is cloning..."
 while true; do 
git clone git@gitee.com:x-hero/${url_list[i]}.git && break
done
echo 'clone done'
 else
echo "${url_list[i]} is already exist! try to pull..."
 if [ ! -d ${url_list[i]}/.git ]; then
echo "pull failed: it's not a git repo!"
 else
cd ${url_list[i]}
 while true; do
git pull && break
done
cd ..
 echo 'pull done'
 fi
 fi
echo '---------------------------------------------------------------------'
done

1.3.2. Ubuntu

程序内容:

#!/usr/bin/env bash

url_list=(`curl -X GET --header \
 'Content-Type: application/json;charset=UTF-8' \
 "https://gitee.com/api/v5/orgs/x-hero/repos?access_token=1ドル&type=private&page=1&per_page=30" \
 | grep -P -o "full_name.*?," \
 | awk -F '/' '{print 2ドル}' \
 | awk -F '\"' '{print 1ドル}'`)

# FIXME
num=5
str='#'
max=100
pro=('|' '/' '-' '\')

echo '---------------------------------------------------------------------'
for ((i=0;i<${#url_list[@]}-1;i++)); do
 if [ ${url_list[i]} == "trash" ]; then
 continue
 fi

echo "[ `expr $i + 1` / `expr ${#url_list[@]} - 1` ]"
 if [ ! -d ${url_list[i]} ]; then
echo "${url_list[i]} is cloning..."
 while true; do 
git clone git@gitee.com:x-hero/${url_list[i]}.git && break
done
echo 'clone done'
 else
echo "${url_list[i]} is already exist! try to pull..."
 if [ ! -d ${url_list[i]}/.git ]; then
echo "pull failed: it's not a git repo!"
 else
cd ${url_list[i]}
 while true; do
git pull && break
done
cd ..
 echo 'pull done'
 fi
 fi
echo '---------------------------------------------------------------------'

 # FIXME
 ((color=30+num%8))
 echo -en "\e[1;"$color"m"
 let index=num%4
 let num+=5
 printf "[%-100s %d%% %c]\r" "$str" "$num" "${pro[$index]}"
 sleep 0.02
 str+='#####'
done

printf "\n"
echo -e "\e[1;30;m"

1.4. 该程序也可以用于在开发过程中一次性pull所有的repo


成就
0
Star
0
Fork
点此查找更多帮助

搜索帮助

回到顶部

AltStyle によって変換されたページ (->オリジナル) /