git remote set-url --add --push origin URL
I have just uploaded all my public git repositories to Bitbucket.org. These repositories were already available at Github, which continues to be the main official public place for them. But should Github be down, they will be available at Bitbucket too.
The only exception to this list is youtube-dl, which started its life precisely at Bitbucket. Later, its development moved to git and Github. Back then, Bitbucket didn’t support git, so I left a few breadcrumbs in the repository for the people who were following the project at Bitbucket so they could move to Github. Those breadcrumbs are still in place and were left untouched.
The easiest way to get stuff pushed to Bitbucket in addition to Github when you run "git push" from the command line is to add a new push URL to the repository configuration.
The only minor drawback is that this will "overwrite" the original push URL if your repository was configured simply with one remote URL for everything. Or at least my version of git does so (220.127.116.11 currently). The original push URL needs to be added back with the same method. Here’s an example from my terminal when I did it for lddsafe.
$ git remote -v origin firstname.lastname@example.org:rg3/lddsafe.git (fetch) origin email@example.com:rg3/lddsafe.git (push) $ git remote set-url --add --push origin 'firstname.lastname@example.org:rg3/lddsafe.git' $ git remote -v origin email@example.com:rg3/lddsafe.git (fetch) origin firstname.lastname@example.org:rg3/lddsafe.git (push) $ git remote set-url --add --push origin 'email@example.com:rg3/lddsafe.git' $ git remote -v origin firstname.lastname@example.org:rg3/lddsafe.git (fetch) origin email@example.com:rg3/lddsafe.git (push) origin firstname.lastname@example.org:rg3/lddsafe.git (push) $ git push Everything up-to-date Everything up-to-date
Note how it pushes to both remotes when you run "git push".
I also have to mention importing my projects to Bitbucket from Github was very easy thanks to the import tools at Bitbucket, which let you import projects from Github by providing a repository URL.
I’m also taking advantage of Bitbucket’s unlimited private repositories even in their free plan, and uploaded the source code for this blog to one private repository there. I’m planning to upload more code to private repositories, like my set of system and user scripts, and probably a few config files that should be backed up with them.
Github vs Bitbucket
Information on the "Github vs Bitbucket" topic tends to get obsolete quickly, but here’s the current state of things in my humble opinion.
Github does git better. It has more web tools for some tasks.
Most people using git for open source is using Github.
Github has projects pages to host static content per-project.
For most small projects, project pages are not used.
Bitbucket has a better free plan, including unlimited private repositories.
Bitbucket lets you send private messages to users.
This comes in very handy when someone forgets to add contact information.
Bitbucket is easier to use in my humble opinion.
The rest is more or less a tie between the two. I don’t get tired of repeating that both web sites are excellent and make sharing source code in open and free source projects incredibly easy.