Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 304
Ben Orozco Avatar asked Jun 10 '10 03:06

Ben Orozco


People also ask

How do I transfer a GitHub repository to another account?

Under your repository name, click Settings. Click Transfer. Read the warnings and enter the repository name to confirm that you've done so. Type the name of the new owner and click I understand, transfer this repo.


2 Answers

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.

like image 106
clee Avatar answered Sep 18 '22 08:09

clee


The easiest way is:

$ git config remote.origin.url <Dreamhost-git-URL> 

You show the remotes after this:

$ git remote -v origin Dreamhost-git-URL (fetch) origin Dreamhost-git-URL (push) 
like image 22
Octavi Fornés Avatar answered Sep 18 '22 08:09

Octavi Fornés