How to remove a remote replace git repository

How to remove remote origin — Change or replace new address/url for remote git repository

1- First Solution:

Suppose you have two remote git repositories, origin and destination and are going to remove destination

Note: git remote rm does not delete the remote repository from the server. It simply removes the remote and its references from your local repository.

To remove the origin remote git repository you can do the same:

or

2- Second Solution:

Replace new address / set new url without Removing remote git

In order not to remove the remote git repository and just replace the new address do this:


git remote -v
# View existing remotes
# origin https://github.com/user/repo.git (fetch)
# origin https://github.com/user/repo.git (push)

git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL

git remote -v
# Verify new remote URL
# origin https://github.com/user/repo2.git (fetch)
# origin https://github.com/user/repo2.git (push)

Written by

Web geek, Self-taught full-stack web developer, Learning Python, Laravel, Vuejs, UX/UI design, Nuclear Physicist PhD

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store