Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the best way to change a Git repo's origin?

Tags:

git

I cloned a read-only Git repo from GitHub onto my server. The next day, I forked that repo on GitHub. What are the steps to update the remotes on my repository and make sure everything on the server is up-to-date?

Is this the way to start? Is there anything else I need to to so that the clone will treat the new origin as if I had originally cloned from it?

git remote rename origin upstream
git remote add origin [email protected]:user/fork.git
like image 444
datguy Avatar asked Oct 05 '11 15:10

datguy


People also ask

How do I change repository?

To change a CodeCommit repository's nameRun the update-repository-name command, specifying: The current name of the CodeCommit repository (with the --old-name option). To get the CodeCommit repository's name, run the list-repositories command. The new name of the CodeCommit repository (with the --new-name option).


1 Answers

Use the commands in your own post, then point the master branch to your new remote (as it has been automatically changed to upstream):

git config branch.master.remote origin

Another way:

git push -u origin master
like image 86
user1686 Avatar answered Oct 05 '22 01:10

user1686