Skip to content

Instantly share code, notes, and snippets.

@drasive
Last active November 12, 2016 13:26
Show Gist options
  • Save drasive/7b49773ec414cdf4c4dbdf1a773e6fe0 to your computer and use it in GitHub Desktop.
Save drasive/7b49773ec414cdf4c4dbdf1a773e6fe0 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Get parameters
git_repository_path=$1 # Path to the Git repository that is used for the backup (local)
git_remote_path=$2 # Path of the Git remote that is used for the backup (external)
# Add files to Git index and create commit
(cd $git_repository_path &&
git add . &&
git commit -m "Automated commit by git-backup" --quiet 1> /dev/null)
# Push to Git remote
(cd $git_repository_path &&
git push --repo $git_remote_path --quiet 1> /dev/null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment