Git push existing repo to a new and different remote repo server?

Question:

Say I have a repository on git.cloudaffaire.com and I want to clone this into my account at Github to have my own playground aside from the more “official” repo on cloudaffaire. What would be the steps to initially copy that over? Within GitHub there is this nice “fork” button, but I can’t use this for obvious reasons.

And how would I track changes in the cloudaffaire repo into the GitHub one?

Answer:

  • Create a new repo at github.
  • Clone the repo from cloudaffaire to your local machine.
  • git remote rename origin upstream
  • git remote add origin URL_TO_GITHUB_REPO
  • git push origin master
  • Now you can work with it just like any other github repo. To pull in patches from upstream, simply run git pull upstream master && git push origin master

Leave a Reply