/doublepush1

The first remote for testing simultaneous push to two remotes.

doublepush

I first created two repositories, doublepush1 and doublepush2 with default READMEs generated by GitHub.

I then cloned doublepush2 then added a new remote with both URLs

$ git remote add doublepush https://github.com/piannaf/doublepush1.git
$ git remote set-url --add doublepush https://github.com/piannaf/doublepush2.git

When I tried to push a change to to doublepush using

$ git push doublepush

It failed because the histories didn't match.

Since I first added doublepush1 URL to create the doublepush remote, the doublepush1 URL was configured as both a fetch and push. Adding the doublepush2 URL meant making it a push-only url.

$ git remote -v
doublepush      https://github.com/piannaf/doublepush1.git (fetch)
doublepush      https://github.com/piannaf/doublepush1.git (push)
doublepush      https://github.com/piannaf/doublepush2.git (push)
origin  https://github.com/piannaf/doublepush2.git (fetch)
origin  https://github.com/piannaf/doublepush2.git (push)

I could make this more robust by creating a seperate fetch/push remote for both URLs, but since my origin and double push fetch from different places, I'll leave that as it is.

So to merge the histories, all I needed to do was git pull doublepush

That resulted in a merge conflict since the default READMEs conflicted.

But now they are the same.

And I've confirmed I can push to both simultaniously with

$ git push doublepush

👍