Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 16c2fafe authored by Olivier Prasse's avatar Olivier Prasse
Browse files

new script to clone RESIF projects

parent f77f6052
#!/bin/bash
############# variables ################
# authentification username
username="ccdump"
# token for ccdump
TOKEN="RQP7ixWoMVk6fxnxfypr"
# url prefix in children.json file
PREFIX="http_url_to_repo"
# number of results per pages (max = 100)
per_page=50
# les repertoires git de OSUG/RESIF/ se trouvent dans le fichier children.json
url_repositories="https://gricad-gitlab.univ-grenoble-alpes.fr/api/v4/groups/192/projects?simple=true&include_subgroups=true&per_page=$per_page"
############ function #################
git_clone()
{
# project list creation
project_list=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" $url_repositories"&page="$page | grep -o "\"$PREFIX\":[^ ,]\+" | xargs -n 1 | sed 's/http_url_to_repo:https:\/\///' )
# project git clone creation on local host
for project in ${project_list[@]}
do
git clone --bare https://$username:$TOKEN@$project
done
}
############ script ##################
# total number of projects
total=$(curl -i -s --header "PRIVATE-TOKEN: $TOKEN" "$url_repositories" | awk '/x-total:/ {printf "%.0f\n", $2}')
# max page calculation
max_page=$(($total / $per_page +1))
for page in `seq $max_page`
do
git_clone
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment