Skip to content

How to remove a remote Git repository?

  • by
  • 2 min read

Remote Git repositories, also known as Git remotes, are pointers that refer to a copy of said repository usually hosted on another server. By default, you’ll have one remote called origin, and as you add different features and environments, it’ll divide into branches. 

However, multiple Git remotes do come in handy when collaborating with multiple people on the same project. If a remote repository moves to another host or stops being active, you might want to remove the related remote.

Also read: How to rename a branch in Git? Local and Remote

How to remove a Git remote?

Removing a Git remote is actually rather simple. You can do it in one of the following two ways.

It’s recomended that you use the git remote rm command.

Using the git remote rm command

The basic syntax for the command is as follows.

git remote rm [remote name]

Make sure to navigate to the directory where your remote is saved before executing the command. If you want to remove a remote named RepoTest here’s how the command will look like. 

git remote rm RepoTest

Note that the command only removes all references to the remote repository and doesn’t actually delete the repository from the server. If you want to verify whether or not the repository was actually remvoed, use the git remote command to list all remote connections. 

git remote -v

Also read: How to remove untracked files in Git?

Using the .git/config file

You can also remove a remote repository by using the ..git/config file. After all, all the git remote rm command does is removing entries about the remote repository from the file itself. However, it’s not recommended that you make changes to the file unless you’re absolutely sure of what you’re doing.

In order to remove a remote repository from the file, simply delete all references of the remote from the file itself and save your changes. If you’ve done it right, all references to the remote repository should be deleted.

Also read: How to delete a repository and branch in GitHub?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: