👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.
Article version: Enterprise Server 2.19

Removing a remote

Use the git remote rm command to remove a remote URL from your repository.

In this article

Were you able to find what you were looking for?

The git remote rm command takes one argument:

  • A remote name, for example, destination

Example

These examples assume you're cloning using HTTPS, which is recommended.

$ git remote -v
# View current remotes
> origin  https://hostname/OWNER/REPOSITORY.git (fetch)
> origin  https://hostname/OWNER/REPOSITORY.git (push)
> destination  https://hostname/FORKER/REPOSITORY.git (fetch)
> destination  https://hostname/FORKER/REPOSITORY.git (push)

$ git remote rm destination
# Remove remote
$ git remote -v
# Verify it's gone
> origin  https://hostname/OWNER/REPOSITORY.git (fetch)
> origin  https://hostname/OWNER/REPOSITORY.git (push)

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.

Troubleshooting

You may encounter these errors when trying to remove a remote.

Could not remove config section 'remote.[name]'

This error means that the remote you tried to delete doesn't exist:

$ git remote rm sofake
> error: Could not remove config section 'remote.sofake'

Check that you've correctly typed the remote name.

Further reading

Were you able to find what you were looking for?

Ask a human

Can't find what you're looking for?

Contact us