首页 > 解决方案 > 删除对远程 Git 存储库的重复引用(不删除存储库)

问题描述

我目前有 2 个对同一个远程 Github 存储库的引用。两个引用都有相同的远程 URL,所以当我这样做时 git remote -v

myrepo  https://github.com/<user ID>/myrepo (fetch)
myrepo  https://github.com/<user ID>/myrepo (push)
origin  https://github.com/<user ID>/myrepo (fetch)
origin  https://github.com/<user ID>/myrepo (push)

我想删除myrepo 远程引用而不删除远程仓库。因此,当我这样做时,我想得到以下结果git remote -v

origin  https://github.com/<user ID>/myrepo (fetch)
origin  https://github.com/<user ID>/myrepo (push)

我不确定是否git remote remove myrepo会删除远程仓库或只是对它的引用。

标签: git

解决方案


git remote rm myrepo就是你要找的。它不会删除远程存储库,只会删除您对它的本地引用。


推荐阅读