Created
August 5, 2014 01:15
-
-
Save joshfreemanIO/c82ca9d91aae4cd934de to your computer and use it in GitHub Desktop.
Backup all repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Backup of git directories | |
DIRECTORIES=( | |
"/Users/josh/EncFS-Decrypted/Finances" | |
); | |
DATE=`date -u`; | |
# For each directory in the directories array, | |
# change to that directory, stage the files, commit | |
# the files and push | |
for DIRECTORY in "${DIRECTORIES[@]}"; do | |
# If the directory change fails, continue the loop | |
if ! cd $DIRECTORY &> /dev/null; then | |
echo "$DIRECTORY is unreachable"; | |
continue; | |
fi | |
# Backup | |
git add . &> /dev/null; | |
git commit -m "Backup on $DATE" &> /dev/null; | |
git push &> /dev/null; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment