Skip to content

Instantly share code, notes, and snippets.

@jpf
Created May 11, 2009 21:21
Show Gist options
  • Select an option

  • Save jpf/110196 to your computer and use it in GitHub Desktop.

Select an option

Save jpf/110196 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script to automatically backup a git repository (via cron for example).
REPOSITORY="/path/to/repository/"
# Redirect STDIO and STDERR to /dev/null
exec 1> /dev/null
exec 2> /dev/null
cd $REPOSITORY
git add .
git commit -a -m "Automatic commit - `date`"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment