| title | Removing a remote | ||||||
|---|---|---|---|---|---|---|---|
| intro | Use the `git remote rm` command to remove a remote URL from your repository. | ||||||
| redirect_from |
|
||||||
| versions |
|
The git remote rm command takes one argument:
- A remote name, for example,
destination
These examples assume you're cloning using HTTPS, which is recommended.
$ git remote -v
# View current remotes
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push)
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (fetch)
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (push)
$ git remote rm destination
# Remove remote
$ git remote -v
# Verify it's gone
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push){% warning %}
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.
{% endwarning %}
You may encounter these errors when trying to remove a remote.
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.