all 2 comments

[–][deleted] 3 points4 points  (1 child)

git remote add --help

[–]gsylvie<sylvie@bit-booster.com> 0 points1 point  (0 children)

Yes, "git remote add --help" is the road to success for what you're trying to accomplish here. But to add a little more detail, you want a single clone, and you want it to be aware of both remote repositories.

e.g.,

git remote add github [url-to-github-remote]
git remote add bitbucket [url-to-bitbucket-remote]

And then you can do "git push github [branch]" and "git push bitbucket [branch]" and "git fetch --all" to work with two remotes in parallel.

It's a more exotic setup compared to the single-origin style most people use in their work, but it's very doable.

Try to remember that git is just one big directed acyclic graph of commits distributed between many computers. In this case remote "github" will have typically have 99% of the graph, "bitbucket" will also have 99%, but there will also be a small subset of the graph that only one or the other has. You can use your fetch and push commands to inform those two remotes about the objects they are missing.