Skip to content

Instantly share code, notes, and snippets.

@rage-shadowman
Last active December 22, 2015 12:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rage-shadowman/6472005 to your computer and use it in GitHub Desktop.
Save rage-shadowman/6472005 to your computer and use it in GitHub Desktop.
Create a backup git repo for a git-svn clone. To restore from such a backup, see: https://gist.github.com/rage-shadowman/6471961
#!/bin/sh
if [ "$#" -ne 1 ]
then
echo 'Usage: $0 <existing-bare-git-repo>'
exit 1
fi
if ! git ls-remote "$1" > /dev/null 2>&1
then
echo "No git repo found at: $1"
echo
echo "You must first create a bare repo. To create one at 'user@host:backup/myproject.git' run the following"
echo " ssh user@host git init --bare backup/myproject.git"
echo
echo 'Usage: $0 <existing-bare-git-repo>'
exit 1
fi
git remote add backup "$1"
git config remote.backup.fetch do_not_fetch_from_backup
git config remote.backup.push '+refs/remotes/*:refs/remotes/*'
git push backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment