by Morgan Aldridge email@example.com
As you probably now know, Google is shutting down Google Code in less than a year and is encouraging users to switch to other open source hosting platforms such as GitHub. They have a handy Export to GitHub tool, which is easy, if a bit slow.
It appears to do a good job on the source code repository side of things, but has a few issues for project wikis (despite automatically converting to Markdown):
- It doesn't preserve history or images.
- It exports the wiki data into a separate 'wiki' branch, not the GitHub project wiki.
There's nothing I can do about the former, but I was able to easily automate resolution of the latter since GitHub allows you to clone project wikis to local repositories. Enter
finishGoogleCodeGitHubWikiMigration, which--given a Google Code project exported to GitHub--takes the
ProjectHome.md wiki page and makes it into the project's
README.md file, plus moves all the wiki pages over to the GitHub project's wiki. It also fixes the page links in the docs.
- You must create at least one page in your GitHub project's wiki (I just created the default
- If you intend to use SSH clone URLs, as opposed to HTTPS clone URLs, you must generate SSH keys.
- Change to a directory where you do not already have the GitHub project in question checked out (for safety reasons, it wants to work on a fresh copy and will not proceed if you already have a copy).
<project>with the user & project names, respectively, of the repository to be cloned from GitHub; you can also use HTTPS clone URLs and would run
finishGoogleCodeGitHubWikiMigration https://github.com/<username>/<project>.gitin that case).
- It should clone the repositories & do its work, leaving you with two locally-modified repositories
<project>.wiki, having committed its changes to each.
- You should then go into each repository & review all the changes. I suggest at least a
git diff HEAD^1on each.
- If, and only if, you feel the changes are correct, you can perform a
git pushon each to commit the changes back to the repository on GitHub.
- Lastly, you can delete the
wikibranch and the
<project>.wikilocal repositories, if you like.
NOTE: This tool modifies the repositories, if you don't like the changes it makes, DO NOT push the changes back to GitHub!
You can also set the "project moved" flag on the Google Code project if you want it to permanently redirect to the GitHub project, but I've found you cannot revert the change.
Copyright (c) 2015 Morgan T. Aldridge
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.