Задача: сделать резервную копию на внешний накопитель репозиториев gitlab.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#!/bin/bash # clone all repos from "apsh" project localy with all brnaches for backup needs. denis proskurin. # use key for authentification DIRECTORY=~/ApshGit cd $DIRECTORY # in repos.txt all repos without ".git" in name for i in $(cat repos.txt);do git clone ssh://git@XX.XX.XX.XX:2001/apsh/$i cd $i # checkout all branches localy. default it's not. only master branch clone for branch in $(git branch -a | grep remotes | grep -v HEAD | grep -v master ); do git branch --track ${branch#remotes/origin/} $branch done cd .. done |
English: Clone all repos localy with all branches for backup