How to change the url of a remote git repo...

Nick Raphael - Dec 7 '21 - - Dev Community

Hi all,

I recently got myself into the situation where all my local git repos had the wrong remote addresses. This was caused by a change up on our git account.

You can see the url that git is currently using by opening the 'config' file in the .git folder. You'll see it under the '[remote "origin"]' section.

Luckily this is pretty trivial to fix. You can either update the url directly in the config file, or run the following command...

git remote set-url origin new.git.url/xyz
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . .