Skip to content

Instantly share code, notes, and snippets.

@ace3
Created April 9, 2021 02:43
Show Gist options
  • Select an option

  • Save ace3/bc4450872aad6c5acc3065704b418f01 to your computer and use it in GitHub Desktop.

Select an option

Save ace3/bc4450872aad6c5acc3065704b418f01 to your computer and use it in GitHub Desktop.

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 git@github.com:[username]/[repository]
git remote set-url --add --push origin git@bitbucket.org:[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	git@github.com:[username]/[repository] (fetch)
origin	git@github.com:[username]/[repository] (push)
origin	git@bitbucket.org:[username]/[repository] (push)

I used this for my Next.js development, using my personal github account and gitlab group account.

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