Automaticly backup the specific Github repositories and/or branches.
- Install git and Initiate local repository; E.g:
yum install git
mkdir -p /git-backup/scripts
cd /git-backup/scripts
git init
git colone [email protected]:xiaojias/git-backup.git
mv ./git-backup/* /git-backup/scripts/
- Add to-be-backedup repository and branch into configuration file; E.g:
vim repo-branch-config.txt
-
Clone the to-be-backedup reposigory into local repository;
-
Create jobs in crontab; The jobs are similar to:
crontab -l
10 0 * * * /bin/sh /git-backup/scripts/git-backup-daily.sh 2>&1
15 0 1 * * /bin/sh /git-backup/scripts/git-backup-monthly.sh 2>&1
- Organization name is hard code in Clone-repo.sh script.