If you want to leave Github for whatever reason, you probably want to take all your code with you, and all your history and branches, etc.
Here's an example for how I moved my Android Eclipse workspace from Github to my own remote server.
First I make a new git repo on my remote server:
$ git --bare init ~/git/workspace
The --bare option means I'm not going to work on the code in the remote git repo directly.
Next I push my current local 'master' to the new repo:
$ git checkout master $ git push ssh://email@example.com/git/workspace master
After that I push my working branch:
$ git checkout work $ git push ssh://firstname.lastname@example.org/git/workspace work
You could repeat this step if you have more branches.
I created my local repo using 'clone' so it has an 'origin' remote branch defined. This 'remote' branch is where git fetches and pushes changes.
Right now my 'fetch' and 'push' remote origins point to Github:
$ git remote -v email@example.com:gdonald/workspace.git (fetch) origin firstname.lastname@example.org:gdonald/workspace.git (push)
So I remove my 'origin' and add the new one:
$ git remote rm origin $ git remote add origin ssh://email@example.com/git/workspace
Then I update my local master's 'remote' to the new 'origin':
$ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master
After this change I can automatically push my commits to the new repo, 'origin' is now selected as my default 'remote' for 'master' :)
$ git remote -v ssh://firstname.lastname@example.org/git/workspace (fetch) origin ssh://email@example.com/git/workspace (push)
$ git push $ git pull