Productive Rage

Dan's techie ramblings

Being a dirty GitHub-to-BitBucket turncoat

After having a bit of a run-in with GitHub a few weeks ago (GitHub and I might be having a falling-out) I was wondering if there was any easy migration route from GitHub over to BitBucket, which I'd been using to house a prototype project I've been doing related to work. We use Mercurial (with Kiln) and after getting over the initial CVS-to-Mercurial teething problems I'm well into it (though being better than CVS isn't that huge an undertaking! :)

The last straw was when I wanted to rename a project within a Visual Studio solution. Using TortoiseHg this is easy; perform the rename, use some "right-click / TortoiseHg / Guess renames" action. (Command line options also available!) But with Git I was struggling to find the best way to do it - I read a load of articles and a handful of StackOverflow posts. It seems like renaming files without changing their contents and then changing their contents will ensure the history is maintained. Usually. Except some times. Or during a full moon.

Ok, I admit, I didn't actually bother trying! And at this point I think I'm glad I didn't, since moving over to BitBucket turned out to be really easy with built-in tools.

A false start

After doing some initial reading around I found out about the BitBucket "Import Repository" functionality. Amazing! Point it at my GitHub repositories and import them into new BitBucket Mercurial repos - ideal! So I select "Git/GitHub" as the source and it set "Git" as the "Repository type", fair enough - it's realised that it has to import from Git! Selected Language as "C#" and hit "Import" and.. it all looked rosey!

I set up Username Aliases to my BitBucket user and had a poke around the history and found it all looked good. It even imported the tags from GitHub which I'd been concerned about since one of the articles I'd read had put some doubt in my mind regarding those.

Then I tried to clone the repository onto my computer. HTTP 501 "Not Implemented". Hmmm.. oh well, it was late, maybe I was doing something dumb.

So then I tried again the next day at work. Same issue. Not too reassuring :( I had a poke around the "My repositories" section and saw that the import repo was marked as being "Git". I tried cloning it and it worked. So imported yes, converted to Mercurial no. Back to the drawing board.

Hg Convert

Thankfully the solution I've ended up with wasn't much more complicated and uses a standard Mercurial Extension (Convert). The quick-fire version is to:

  1. Ensure the "convert" extension is enabled by going into Global Settings in TortoiseHg (or adding "convert=" to the "[extensions]" section of your mercurial.ini file manually if you're Tortoise-adverse)
  2. Open a command prompt
  3. Enter "hg convert c:\folder\name\of\git\repo" (quoting the location if there are any spaces)
  4. This will create a new folder in the command prompt's current location, taking the Git repo's name and suffixing with "-hg" (so "repo-hg" in this example)
  5. Move into folder and enter "hg update" to pull in the files
  6. Profit! :)

I created a new (Mercurial!) repository in BitBucket and pushed from the local repo up to it. Easy!

The repository I was playing with here had various commits by me under different usernames. I set up aliases to my BitBucket account for these but the convert extension offers options to remap author names so that these aliases aren't required (see the Convert docs).

Looking back

I must admit that part of the reason I started up the GitHub account was to build up a portfolio of demo code for when the day comes that I decide I want to look for alternative employment. And for some reason having a GitHub account just sounds cooler than BitBucket! But maybe that's just been engrained into me by the many many references to a GitHub portfolio that I've heard made on Hacker News over the years. Plus I'm going to miss the GitHub cat logo - BitBucket just doesn't seem quite as friendly without it!

Posted at 20:44


GitHub and I might be having a falling-out

GitHub Status Indicator Last week I encountered some problems with pushing and pulling against my GitHub repositories. I've been using them (only on and off, granted) for a good few months now, maybe a year, and I've had no real issues with it. In fact for a free service it's been great - I like the UI (and the logos! :) and everything has been straight forward and let me play with Git for the first time.

But then it stopped playing with me.

Clicking on the "Help" link when in GitHub goes to which has a "Site Status" indicator, which is cool. It was showing a happy green "All systems operational" display.

I thought maybe it was TortoiseGit since it had been bugging me about updates for a while. So I uninstalled it and re-installed it and went through some questions that I remembered not really understanding from last time.. :( One tutorial I'd read those months ago had recommended using OpenSSH while another recommended PuTTY. I couldn't remember which I'd used in the past. I'd stored an SSH password somewhere but couldn't remember what it was for. So I tried sticking with the defaults (always a reasonable first-approach plan! :) and still wasn't getting it to communicate with GitHub properly..

Turns out that now the status page was showing that the service was indeed encountering difficulties. And I see now they have a Twitter account to keep you abreast of such issues. That's a nice touch.

So I waited it out and then tried to get TortoiseGit working again. I can't remember exactly what hoops I had to jump through in the end. There was a load of faff about re-generating SSH public keys and registering them in the Admin section of my GitHub account. And some more and back and forth where authentication attempts would keep getting rejected because some PuTTy-related component insisted on being run manually (although this was somehow ironed out too such that it would fire up automatically at the first attempt).

And then I finally got it going again and couldn't successfully push a new tag up to GitHub. Then I remembered you have to choose "Push tags" in Git Sync. It won't do it otherwise.

I think, on the whole, I've just been spoilt by all my recent dealing with Mercurial. I work solely with Windows and I'd sort of heard vague mutterings about Mercurial being an easier fit with Windows than Git and I think it's taken until now to get some first-hand experience.

At the end of the day

I'm not sure how I feel about this whole episode. Don't get me wrong, I think GitHub's handling was basically first-rate - they openly admit when issues are detected and then keep you up-to-date with progress on fixes. That's awesome. It's a bit annoying that they hadn't noticed the problem when I first encountered it which is why, I presume, they were reporting "All systems operational" when all systems were not entirely operational. But I'm really not annoyed with them, I'm annoyed with how much harder work TortoiseGit with Windows is compared to TortoiseHg. Maybe my DVCS GUI reliance is my problem! For a lot of things, I love the command line - but I feel much more comfortable with a GUI for source control; so I can easily see what's changed, added, deleted, so I can do a last-minute diff on every file before I commit - it just seems easier!

I think I'll hold-fire on any hasty decisions for now. In large part because I've been mostly happy with the experience so far and in part because seeing the GitHub logos every time I check in online entertains me! :D

Posted at 22:16