How to change a remote URL in Git
In this tutorial, we are going to learn about how to change a cloned repo remote url in git.
Changing a Git remote URL
- Change your current working directory to the cloned git repo folder.
cd my-git-repo
- To change a remote URL we need to run the
git remote
command followed by theset-url
,origin
and your new remote url.
git remote set-url origin https://github.com/saigowthamr/javascript.git
Note: In the above code, you need to add your own remote url after
origin
.
- Now we need to verify our remote url is changed successfully or not by running
git remote
command followed-v
flag.
git remote -v
The output will look like this:
origin https://github.com/saigowthamr/javascript.git (fetch)
origin https://github.com/saigowthamr/javascript.com.git (push)