Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrate git repo from Google Code to Github

I have a git project hosted on Google Code. I'd like to move it to Github, with the revision history included. I don't use the ticket system so that won't matter.

In similar questions like mine, the problem is migrating from a SVN repo in Google Code to Github. I'm already using git.

I have the project checked out on my machine because I'm developing on it. From what I understood from git, my local project already includes the full history because of its distributed nature. So maybe copying it to github is really simple, but I don't know the steps.

Of course the idea is that new changes will be pushed to Github and the Google code repository would remain frozen.

like image 644
Luciano Avatar asked Jan 17 '13 21:01

Luciano


People also ask

How do I move a Git repository to GitHub?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", click Transfer. Read the information about transferring a repository, then type the name of the user or organization you'd like to transfer ownership of the repository to.

How do I import code into GitHub repository?

In the upper-right corner of any page, click , and then click Import repository. Under "Your old repository's clone URL", type the URL of the project you want to import. Choose your personal account or an organization to own the repository, then type a name for the repository on GitHub.


2 Answers

Create a github repository, and make sure your SSH key, etc... is installed properly.

Check out your repository from google.

Run:

git remote add github <URL FROM GITHUB>
git push github HEAD

That will push your current branch. You can push others by switching to them and repeating the git push github HEAD (or other, more advanced ways).

like image 118
gahooa Avatar answered Oct 02 '22 20:10

gahooa


On Github create an empty repository, push your local repository to it -- done.

At that point if you want all future pushes to go to Github, change the origin remote to point to the Github repository instead of the one at Google Code -- or you can clone a new working repository from Github.

like image 26
David Culp Avatar answered Oct 02 '22 19:10

David Culp