Importing a project into github

We’re moving our development projects into github, so we wanted to get a copy of the code (checked out of Subversion) into a new project in github.

Here are the steps (assumes that you’ve set up your ssh keys correctly, according to e.g.

Setup the git globals:

$ git config --global "Julian Higman"
$ git config --global "jh @"

Create the new project, add a README file, and connect it to the github remote project:

$ mkdir my-new-project
$ cd my-new-project/
$ git init
$ touch README
$ git add README
$ git commit -m "First commit"
$ git remote add origin
$ git push -u origin master

Now copy in the project source files, excluding svn files and other project config files:

$ cd ..
$ rsync -r --exclude=.svn --exclude=.buildpath --exclude=.project --exclude=.git my-old-project/ my-new-project/

Then add the new files, commit them, and push to the remote repo:

$ cd my-new-project/
$ git add -A
$ git status
$ git commit -m "added project files"
$ git push



Leave a Reply

Your email address will not be published.