First, create your repo on Github. Then change directory to the checked-out source repository - suppose you want to push the master
branch. You need to execute 5 simple steps:
git remote add origin2 https://github.com/user/example.gitgit checkout mastergit pullgit push origin2 mastergit remote remove origin2
This creates the link between your local repo and the new remote, check out and pulls the source branch (to ensure that it has the latest), then pushes the current branch, finally unlinks the local repo from the remote.
Your local repo will be intact after this, you can use it as before. If you need to push multiple branches, repeat the checkout
-pull
-push
steps as many times as you need, just change the branch name accordingly.