Accessing git repositories with hg (mercurial) tools
Tags: coding, git, github, hg, mercurialAdd comments
Preface
Once upon a time we switched from subversion to Mercurial (or hg) as source control system. We choose hg because at that time the tool support on windows was much better for mercurial as for git. Not all of us wanted to go the console-only approach and I still love my TortoiseHg very much. We are very happy with our hg setup and have no intension to move away from it.
But from time to time I come across a git repository I want to clone or I have to collaborate with somebody else on a git repository. Soon I’m planning to release a project on github since this is currently the community to go if you want to publish your stuff. But still I would like to stick with only a small set of tools.
The Hg-Git Mercurial Plugin
Instead of getting git to my machine (in fact it is running here anyway) I found the Hg-Git Mercurial Plugin. This allows you to use hg on your local box but pull and push to a git repository.
On first sight it works pretty nice but I had some challenges to overcome when installing it. And that’s what this post will be about.
Installing the Plugin
The homepage of the Plugin itself can be found at http://hg-git.github.com/ with the source code available at github and bitbucket.
Even with easy_install available on my windows machine I could not install the plugin as described at “Installing Hg-Git the easy way” but the other way “Installing Hg-Git manually” is not much work at all. Dulwich was installed when I tried the easy way before, so I only had to get the code and edit the hg config file.
Get authentication working with github
For each repository over at github the SSH url is shown at the website like
git@github.com:irgendwienet/testing.git
To use this with your hg installation just prefix it with git+ssh:// like
git+ssh://git@github.com:irgendwienet/testing.git
But then a “PuTTY Fatal Error” in a message box pops up “Disconnected: No supported authentication methods available (server sent: publickey)”
So you have to do two things: upload your public ssh key to github and explain your local system to connect using your private key.
To upload a public key just log into github, go to Account Settings and into the SSH Keys section.
Then open putty.exe and configure the following:
- Host Name = github.com
- Connection / SSH / Auth / Private key file for authentication = your key file
Save this session as “github” (the name will be imported during the next step).
Now try cloning the repository again but instead of the actual URL (github.com) use the name of the session (just “github” in my case). Putty looks for this session and finds the actual URL with the key.
git+ssh://git@github:irgendwienet/testing.git
Recent Comments