To setup push to multiple remote with single git push
, you need to do this:
- Clone the repo like usual
- Setup multi remote URL like this
git remote set-url --add --push origin [email protected]:[username]/[repository]
git remote set-url --add --push origin [email protected]:[username]/[repository]
Take notes on the --push
, meaning only add the push side of the remote.
- Verify by run this command
git remote -v
, then you should see something like this:
origin [email protected]:[username]/[repository] (fetch)
origin [email protected]:[username]/[repository] (push)
origin [email protected]:[username]/[repository] (push)
I used this for my Next.js development, using my personal github account and gitlab group account.