Sunday, September 25, 2011

Github as the second remote

This is a brute-force way of setting up github as a second remote/backup to your code.

1. $ cp -r repo repo_backup
2. $ cd repo_backup and then vim .git/config
delete the old [remote "origin"]
3. $ git remote add origin git@github.com:username/repo_name. Now you should see its corresponding lines in .git/config
4. I want to push my local branch "b1" to a branch on github named "branch1", so I did git push -u origin b1:refs/heads/branch1

No comments:

Post a Comment