Continuing on my previous post on how to set up a Mercurial repository locally in under 5 minutes: what if you now want to push your changes to a remote repository? You might want to collaborate, or maybe you just want the backup. Or you want to develop across multiple machines.
This is done very easily too. This is the procedure for Bitbucket, which I use:
Fill in the details in the next screen (name, description, private/public repository, etc.). After that, select ‘I have code I want to import’ in the ‘Get started’ tab. Here you’ll see the commands to push to your repository. As I’m using TortoiseHg, all I want is the URL of my repository:
Now paste the relevant parts in the sync tab of your TortoiseHg Workbench (selecting https as protocol) and click the save icon (curiously to the left of the URL).
You can give the path an alias, but usually you’ll keep it as ‘default’. If you choose to remove the authentication data from the URL, you’ll have to enter the username everytime you push, which might not be as convenient.
Finally, click on the icon to push your changes to the server, enter your password, and you’re done!
Again, very quickly, we have pushed our local repository to a remote one. This gives us the opportunity of collaborating, backing up, sharing, etc. This was all done with a minimum of friction, which is what a good version control system should do. And by extension, any good tool should just get out of your way and let you focus on what needs to be done.