backup script for all your public & private repository on github
git clone https://github.com/ambersun1234/repoBackup.git
-u, --user
: github account's user name-t, --token
: Personal Access Token( PAT ) file location-l, --location
: backup storage location( e.g. /mnt/mystorage/backup )--help
: bring up help manual
- make sure that
curl
is installed in your machine- install curl by
sudo apt install curl -y
- install curl by
- for backup
private
repository , please generate yourPersonal Access Token(PAT)
first , store the PAT into your local machine , and add-t
flag in execution.
creating a personal access token for the command line
cd repoBackup
chmod +x autoBackupGitHub.sh
./autoBackupGitHub.sh -u YOUR_GITHUB_USER_NAME -l /PATH/TO/STORAGE -t ./YOUR_PERSONAL_ACCESS_TOKEN_FILE
- configure parameter
- open
run.sh
file , in the final line , change YOUR_GITHUB_USER_NAME and /PATH/TO/STORAGE and YOUR_PERSONAL_ACCESS_TOKEN_FILE( if needed )
- open
- setup crontab to auto run backup script
crontab -e
0 0 * * 1 bash ./repoBackup/run.sh > /home/USER/.cron.log 2>&1
- save and exit , no need to restart crontab
- this will run for every monday at 00:00
- the log file will be written to
/home/USER/.cron.log
, check it out usingcat ~/.cron.log
This project is licensed under GNU General Public License v3.0 License - see the LICENSE file for detail