Skip to content

Instantly share code, notes, and snippets.

@ptitfred
Created August 12, 2010 22:23
Show Gist options
  • Save ptitfred/521878 to your computer and use it in GitHub Desktop.
Save ptitfred/521878 to your computer and use it in GitHub Desktop.
sudo adduser --disabled-password backuper
sudo su backuper
cd ~/.ssh
ssh-keygen -t dsa
# entrée pour ne pas saisir de passphrase
# entrée pour garder le nom par défaut, très satisfaisant
#!/bin/sh
GIT_BACKUP_HOME=~backuper/git-backup
time ~backuper/bin/fetch-all.sh
0 * * * * ~/bin/backup-git.sh > /tmp/git-backup-cron.log
#!/bin/sh
OLD_DIR=$(pwd)
if [ -d "$GIT_BACKUP_HOME" ]
then
cd $GIT_BACKUP_HOME
else
cd $OLD_DIR
echo "No GIT_BACKUP_HOME set, exiting"
exit 1
fi
echo "########################################"
echo " Backuping [email protected] repositories"
echo " from directory $GIT_BACKUP_HOME"
for project in $(ls)
do
if [ -d $project ]
then
cd "$project"
git branch >/dev/null && (
echo "--------------------"
git remote -v | grep origin | cut -f2
git fetch origin
echo "done"
)
cd ..
fi
done
echo "########################################"
cd $OLD_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment