Skip to content

Instantly share code, notes, and snippets.

@rvillablanca
Last active May 5, 2018 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvillablanca/b69432acb96c043f727d761551e221d2 to your computer and use it in GitHub Desktop.
Save rvillablanca/b69432acb96c043f727d761551e221d2 to your computer and use it in GitHub Desktop.
Push to another remote repository
#!/bin/bash
if [ -z "$1" ]
then
echo "no remote name"
exit -1
fi
if [ -z "$2" ]
then
echo "no remote url"
exit -1
fi
git fetch --all -v --prune
git remote add $1 $2
git push $1 master
git push $1 'refs/remotes/origin/*:refs/heads/*'
git push $1 :HEAD
echo "Pushed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment