Git Snippet: Repoint Remote

From Coder Merlin
Revision as of 12:33, 11 April 2019 by Chukwuemeka-tinashe (talk | contribs) (Created page with "== Repoint a Repository to a New Remote == List current remotes: <syntaxhighlight lang="bash"> git remote -v </syntaxhighlight> Change remote: <syntaxhighlight lang="bash">...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Repoint a Repository to a New Remote[edit]

List current remotes:

git remote -v

Change remote:

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

If there are already files present in the repository, you may need to pull:

git pull

If you encounter an issue with unrelated histories, you may want to ignore this condition:

git pull origin master --allow-unrelated-histories

Additional reading: Changes a Remotes URL (GitHub)