Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hg-Git: How to push to both Github and Bitbucket?

I just installed Hg-Git and I was wondering if it is possible to push to both Bitbucket.org and Github.com from the same repository. I'm thinking of something like:

$ #make commits
$ hg push #pushes to Bitbucket since it is set as `default` in hgrc
$ hg push "github remote alias" #push to Github

So, by default it pushes to Bitbucket, and to push to Github by specifying a "remote" alias.

like image 984
john2x Avatar asked Apr 02 '11 15:04

john2x


People also ask

How do I push to Bitbucket from github?

To push to a Git repository At the command line, make sure you've changed into the repository directory. Enter git push at the command line to push your commits from your local repository to Bitbucket. To be specific about exactly where you're pushing, enter git push <remote_server> <branch_name>.

Can you fork from github to Bitbucket?

When creating a new repository in BitBucket, click the button Import repository at the top right. Enter the https url found when clicking Clone or download in Github for the repository you want to fork. Give your repository a name, configure your privacy settings, and there you go!

What happens if two people push to git at the same time?

If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.


1 Answers

If your question is how to make hg push able to push to multiple remote destinations, one by default and one named, then that's easy.

You edit the .hg\hgrc file in your repository and add/modify:

[paths]
default = https://hg01.codeplex.com/mercurialnet
kiln = https://lassevk.kilnhg.com/Repo/Mercurial-Net/dev/trunk/

The above is my setting for one of my projects. By default, ie. just hg push it pushes to CodePlex, but I can also ask it to push to kiln by executing hg push kiln.

The one named default is basically the one used if you don't specify the alias for a remote destinations, and you can have 0 or more named ones in addition to default.

If that was not your question, please elaborate.

like image 167
Lasse V. Karlsen Avatar answered Oct 22 '22 03:10

Lasse V. Karlsen