#!/bin/bash echo "Sync books" # activate credential cache git config --global credential.helper cache git config --global credential.helper 'cache --timeout=7200' folder='book-src' host='https://figureslibres.io/gogs/bachir' # echo "$host" repos[0]='TDSM-oeuvres' repos[1]='TDSM-notices' repos[2]='TDSM-commissaires' repos[3]='TDSM-english' # echo $repos for repo in "${repos[@]}" do echo ${repo} if [ -d $folder/$repo.git ]; then # if repos exists, pull echo 'Pull $repo' git -C $folder/$repo.git pull origin master else # if repos does not exists, clone echo 'clone $repo' git clone $host/$repo.git $folder/$repo.git fi done