Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Adds a remote repository to an existing repository. This can be used for transferring repositories to multiple Git providers. It can also be useful for sharing code.
# Adds a remote called 'github' to your repository
git remote add github https://github.com/your_username/your-git-repository.git
# Bare, mirrored push to 'github' remote repository
git push -mirror github
# clone a bare, mirrored repository
git clone --mirror https://github.com/your_username/your-git-repository.git
# Change origin to new URL
git remote set-url --push origin https://github.com/your_username/your-git-repository.git
# Push repository to new origin and retain history
git push --mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment