Skip to content

Instantly share code, notes, and snippets.

@JonathanTron
Created April 10, 2010 06:40
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save JonathanTron/361875 to your computer and use it in GitHub Desktop.
# go to your repository
cd my_project
# check your existing remote
git remote -v
# origin git@mydomain.tld:my_project.git (fetch)
# origin git@mydomain.tld:my_project.git (push)
# Add a new remote, a github.com private repository for example
# the --mirror flag is what's different from a simple new remote
git remote add --mirror git@github.com:Openhood/my_project.git
# Check the new remote
git remote -v
# github git@github.com:Openhood/my_project.git (fetch)
# github git@github.com:Openhood/my_project.git (push)
# origin git@mydomain.tld:my_project.git (fetch)
# origin git@mydomain.tld:my_project.git (push)
# To discover the difference check you .git/config
# the new remote has the config mirror = true
cat .git/config
# ... file start skipped ...
# [remote "github"]
# url = git@github.com:Openhood/my_project.git
# fetch = +refs/*:refs/*
# mirror = true
# Now all you have to do to mirror your entire repository is
git push github
@munyengm2
Copy link

The line: git remote add --mirror git@github.com:Openhood/my_project.git
Should be: git remote add --mirror github git@github.com:Openhood/my_project.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment