How to change the URL of a remote Git repository?

Let's say if you set the origin as the wrong repository URL of your git project, and you want to change the remote URL of the origin to the correct one.

Let's say you set the origin as the wrong repository URL of an existing local repository; then you can change the remote URL of the origin by running the following:

git remote set-url origin <url of the actual repo>

Originally Posted On: StackOverflow

Subscribe to GIT.WTF!?!

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe