Wednesday, August 25, 2010

GitHub Forked Projects Warning

Template projects, particularly in Rails, have become very popular. If you are in a hurry to get a project off the ground, it is nice to start with a base project that includes your favorite goodies like acts_as_authenticated, active_merchant, paperclip, etc. There is a hidden danger that I just encountered recently, though. If the person you fork your project from has a paid account, and they stop paying, you lose access to your source code.

The simple solution: After cloning the project, check it in as a new project to your account.

What my experience was:

Thursday night, I was working on an urgent issue that had to be fixed for Friday morning. I fixed the issue at 2:00am and went to check the code into the repository. The message I got back was:

ERROR: Account `<redacted>' is disabled. Please contact support@github.com or ask the owner to check their account.
fatal: The remote end hung up unexpectedly

Eeep! I don't think I had ever seen the name of the account owner mentioned before (I came into this project after it was started). To make matters worse, the person who owned the account containing the project was on a fishing trip. What was I to do? I opened a ticket with github, but I couldn't wait for them to resolve the issue. I used git's wonderful diff tool to create a patch which I could then install on the server.

It turns out, "patch" was not installed on the server! Very carefully, I copied the changes one by one from the patch to the code (I know - installing patch may have been faster, but I was over stepping my authority already). Fortunately, the manual patch worked.

The next morning, GitHub support explained the issue and offered to "un-fork" the repository for me. After that, I was able to use the repository again. I returned to the server, used "git stash" to remove the manual changes and updated. All was good.