Error with renamed repo in GitHub: "remote: This repository moved. Please use the new location"

Question

I am receiving this notice when I push updates from my local instance to remote master on GitHub:

remote: This repository moved. Please use the new location [new location]

Is there a way to fix this?

Answer

The simple way is:

git remote set-url origin [updated link url https://........git]

Alternatively, if you like the long way it is:

git remote rm origin
git remote add origin [updated link]

Changing a remote's URL GitHub documentation goes into further detail.

How to search a Git repository by commit message?

How to find the commit in which a given file was added?