DEV Community

Cover image for Change the repository source
Edson Junior de Andrade
Edson Junior de Andrade

Posted on • Updated on

Change the repository source

First check the source of your repository.

git remote -v
Enter fullscreen mode Exit fullscreen mode

Rename the current source to ensure that there will be no conflict.

git remote rename originname ancient-origin
Enter fullscreen mode Exit fullscreen mode

Define the new repository source.

git remote add origin repository_address
Enter fullscreen mode Exit fullscreen mode

Check if the changes occurred as requested.

git remote -v
Enter fullscreen mode Exit fullscreen mode

To avoid the accumulation of sources, remove the old source.

git remote rm ancient-origin
Enter fullscreen mode Exit fullscreen mode

Again, check that the changes have occurred as requested.

git remote -v
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
jmau111 profile image
jmau111 🦄

you can use git remote set-url origin repository_address to change the origin quickly.