Leaving Github, how to change the origin of a Git repo?

Ben Orozco picture Ben Orozco · Jun 10, 2010 · Viewed 28.5k times · Source

I'm hosting a project in Github, but now I purchased a plan with Dreamhost that includes shell access and Git.

      Github [Origin]
       /         \
  pull/           \pull
     /push     push\
    /               \  
Laptop           Dreamhost
(cloned)          (cloned)

I would like to delete my repo from Github, and starting push directly to DH.

How do I change origin in my Laptop, and should I delete the origin in Dreamhost?

Answer

clee picture clee · Jun 10, 2010
git remote rename origin github
git remote add origin <DreamHost-git-URL>
# test and make sure the DreamHost origin works properly for fetch and push
git remote rm github

I prefer using the 'git remote' command instead of screwing about with the .git/config file by hand.