by Sai gowtham

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

  1. Change your current working directory to the cloned git repo folder.
cd my-git-repo
  1. To change a remote URL we need to run the git remote command followed by the set-url, origin and your new remote url.
git remote set-url origin

Note: In the above code, you need to add your own remote url after origin.

  1. 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 (fetch)
origin (push)