git remote rm 命令使用一个参数:
- 远程名称,例如
destination
示例
以下示例假设您使用 HTTPS 克隆,即推荐使用的方法。
$ git remote -v
# 查看当前远程
> origin https://github.com/OWNER/REPOSITORY.git (fetch)
> origin https://github.com/OWNER/REPOSITORY.git (push)
> destination https://github.com/FORKER/REPOSITORY.git (fetch)
> destination https://github.com/FORKER/REPOSITORY.git (push)
$ git remote rm destination
# 删除远程
$ git remote -v
# 验证其已删除
> origin https://github.com/OWNER/REPOSITORY.git (fetch)
> origin https://github.com/OWNER/REPOSITORY.git (push)
注:git remote rm 不会从服务器中删除远程仓库。 它只是从本地仓库中删除远程及其引用。
疑难解答
当您尝试删除远程时可能会遇到以下错误。
无法删除配置部分 'remote.[name]'
此错误表示您尝试删除的远程不存在:
$ git remote rm sofake
> error: Could not remove config section 'remote.sofake'
检查您是否正确键入了远程仓库的名称。

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
