How to Simultaneously Push to 2 Repositories and Keep Them in Sync
If you find yourself needing to have two GitHub repositories with identical content and want to effortlessly push your changes to both, I have a solution for you. Here’s what you need to do:
Start with a working repository in Git, already set up with the
origin
remote.Create a new empty repository on GitHub.
Add the URL of the new repository as another URL for the
origin
remote using the following Git commands:
1 | git remote set-url --add --push origin [email protected]:flaviocopes/original.git |
That’s it! Now, whenever you perform a “git push,” your changes will be sent to both repositories simultaneously, ensuring they stay in sync.
Tag: Git, GitHub, remote repositories, synchronization