If you’re new to Git, this tip will allow you to save some of your precious time.
Open .git/config in your project’s local directory, and, in the category [remote “origin”], modify the url parameter, using the new location or the new repository’s name.
OR
Use this command:
git remote set-url origin <new url>
Note: If you’re using GitHub, you must also rename the project on the platform: Go to the repository’s homepage, click the Admin button and change the name.
Translated from my french post Git: Renommer ou changer l’adresse d’un dépôt