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