How to move your Google Code projects to GitHub

Google Code is closing, and you want to click that ‘Export to GitHub’ button. Great! Make sure you do the rest of these things too…

Introduction

Google Code allows anyone to export a project to GitHub. You don’t have to be logged in to a project you own to do so – this means that you can export a project that you use, even if the owner has abandoned it. This might be important in the upcoming months, since Google Code is closing in January 2016, less than a year away.

Whether you’re the owner or not, there is a handy tool built into Google Code to migrate.

Please note that these steps do not migrate private issues in the issue tracker, and your mileage may vary for very complex project setups. If you were an extensive user of Google Code and use more features than just code hosting, please the FAQ. However, if you just have a simple project, as most are, the following will guide you to moving your project across.

By the end of this article, you will have:

  • Moved the repository, including commit history, from the Google Code project to a new GitHub project
  • Updated the Google Code project to redirect to the new project location
  • Updated the Google Code repository so users updating will find out they need to use the new project location
  • Set up some basic project settings in your new GitHub project.

Exporting to GitHub

Makes sure you’re logged in to GitHub, and click the ‘Export to GitHub’ button on the project page:

Google Code - Export to GitHub
The ‘Export to GitHub’ button is on the right-hand side of your project’s tabs.

You do not want to have to do it the canonical git way.

GitHub will send you an email when the conversion is done. Note that it may fail – one of my three projects failed, without a reason being given. If that occurs, the project will still have been created for you on GitHub, and when you click the link on your front page to be taken to it, you will be taken to a page to re-start the import. Importing a second time around worked for me.

At this point you might think you’re done, and in some sense you are, but a thorough migration will have several more steps.

More steps on the Google Code side

It is important to close down the GC project and redirect users to the new GitHub project. You don’t want users to think that the GC project is still active, maintained, or exists – all users should be redirected to the new project.

  1. Important: Move to the Administer tab, Advanced subsection. There is a button saying Project Moved, and a URL text field. Paste the location of the migrated-to GitHub account – eg, ‘https://github.com/vintagedave/transparent-canvas’; rather than copying the URL when you are logged into GitHub, get a clean URL by right-clicking on the project link:
    This link gives you a 'clean' link to your project page, rather than the one your login shows. Copy this URL.
    This link gives you a ‘clean’ link to your project page, rather than the one your login shows. Copy this URL.

    and click the ‘Project Moved’ button:

    Entering the project moved location in the Google Code project settings
    Entering the project moved location in the Google Code project settings

    Now when users access your project homepage, they will instead be taken to a page pointing them to the new GitHub location. The GitHub exporter does not automatically do this for you.

  2. Optional: What happens when users SVN-update (or similar) the old project? Nothing: the operation will complete successfully, even after the project has been moved. This is an oversight on Google’s part; it means that if users never visit the GC project webpage, they will never know they are missing out on changes. To them, they will simply stop seeing anything new appear when they update.
    I personally would make a commit noting the change. For each of my projects, I have added a text file in the root or trunk which is named ‘moved to github.txt’ and contains the new project URL. The commit message also contains the new project location:

    Final commit into the SVN repository, telling users the project has moved.
    Final commit into the SVN repository, telling users the project has moved.

At this point, you’re done on the Google Code side. Just a few more things to do.

More steps on the GitHub side

Your Google Code project was probably set up with a description and some other information for users, telling them what the project is. This isn’t migrated, so you need to set up your project with at least some minimal information.

  1. On your project page, under the name, will be an auto-generated description saying it was migrated from Google Code. Click the Edit button next to this:
    Click 'Edit' to change this to something more descriptive and add a project homepage URL.
    Click ‘Edit’ to change this to something more descriptive and add a project homepage URL.

    and fill in a short description, and possible an URL for the project homepage if you have a website devoted to it. Unlike Google Code’s long-form description this one should be a single line or sentence. It should end up looking something like this:

    Entering a description and URL. Click Save :)
    Entering a description and URL. Click Save :)
  2. Finally, add a Readme file. This is simply standard practice, and is where the longer description from Google Code should go. GitHub automatically prompts you to do this via a green button at the bottom of your project page, below the file listing. This file is in Markdown format, and once entered, your longer project description will be shown, formatted, below the file listing.
    You should probably mention the project license here. Unlike Google Code, there is no automatic license listing on the project page.

Other items: issue tracking, etc

The above is enough for simple projects. If you have a more complex setup, such as using Google’s issue tracking, or if you want to migrate a project to an organization on GitHub, you will need to follow the steps in the FAQ.

Done!

And that’s it. You’re done.

There are plenty more things you might want to set up on your GitHub project page (have a look at the project settings – there are some things worth checking out, including an automatic webpage generator to make a project website; wiki and editing restrictions; start watching activity on the project – it ignores, ie you are not notified of, all activity by default; etc) but you’ve done the essentials:

  • You project has been moved from Google Code to GitHub
  • Users know it has moved, whether they access it by the old Google Code page or simply by updating or examining the commit log
  • The GitHub project page has been updated with basic information about the project.

Happy coding!