How to remove a remote from git
git
remote
remove
git remove remote
To remove a remote you can use the command git remote rm
in the terminal, from the root folder of your repository.
The git remote rm
command has one parameters:
- the existing remote name;
Git remove remote
The example will remove the gitlab
remote. Note that the command will not delete the repository, just the local reference.
C:\Users\adm\repos\jersey-hello-world>git remote rm gitlab
To check that the remote was removed run the following command:
C:\Users\adm\repos\jersey-hello-world>git remote -v
github https://github.com/admfactory/jersey-hello-world.git (fetch)
github https://github.com/admfactory/jersey-hello-world.git (push)
The remote you just removed should not be in the list anymore.
Errors
If the remote name doesn't exist the following error will occur:
error: Could not remove config section 'remote.gitlab'