I want to remove this remote repository (origin) and add a new one with a different URL (new-URL). How can I do this?

I initialized my folder as a Git repository using git init and added a remote repository with git remote add origin URL. Now, I want to remove this remote repository (origin) and add a new one with a different URL (new-URL). How can I do this?

Hey Mirosalv,

I think instead of removing and re-adding the remote repository, you can update the URL directly:

git remote set-url origin git://new.url.here

To remove the existing remote repository, you can use:

git remote remove origin

For more details, you can refer to this question: How to change the URI (URL) for a remote Git repository?

Hey Miroslav,

To add to your answer, what can @MiroslavRalevic do to remove a remote repository named origin? You can use the following command:

git remote remove origin

To add a new remote repository with a URL yourRemoteUrl, you can use:

git remote add origin yourRemoteUrl

Finally, to push your changes to the new remote repository, you can use:

git push -u origin master

These commands will remove the existing remote, add a new remote, and push your changes to the new remote repository.

Hello Miroslav,

To remove the existing remote named origin and then add a new remote, you can use the following commands:

git remote remove origin

Followed by:

git remote add origin http://your_url_here

These commands will remove the origin remote and add a new one with the specified URL.