Skip to content

Instantly share code, notes, and snippets.

@Phocacius
Created January 14, 2015 16:05
Show Gist options
  • Save Phocacius/72ec83d8b9c890028b71 to your computer and use it in GitHub Desktop.
Save Phocacius/72ec83d8b9c890028b71 to your computer and use it in GitHub Desktop.
copies an arbitrary Git repo (including all branches and tags) and pushs it to another repo. The destination repo has to be completely empty!
mkdir tmp
echo 'Enter URL of old repo:'
read oldrepo
echo 'Enter URL of new repo:'
read newrepo
cd tmp
git clone --bare $oldrepo
REPO=`ls`
cd $REPO
git remote add destination $newrepo
git push --all destination
git push --tags destination
cd ..
rm -rf $REPO
cd ..
rm -rf tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment