How to remove a remote from git

  • 14 April 2020
  • ADM


How to remove a remote from git - images/logos/git.jpg


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 (fetch)
github (push)

The remote you just removed should not be in the list anymore.


If the remote name doesn't exist the following error will occur:

error: Could not remove config section 'remote.gitlab'