'git remote -v' 在本地删除不需要的存储库

'git remote -v' delete unwanted repositories locally

当我在 git bash 中键入 git remote -v 时,我得到了所有存储库 url 的列表,问题是它们都已过时,我想将它们全部删除。我该怎么做?

您可以使用 git remote remove 按名称删除遥控器。例如:

$ git remote remove myremote

删除遥控器的选项很少

  • 您只需编辑 .git/config 文件并删除它们
  • git remote remove <remote>
  • git remote rm <remote>
  • git remote prune <remote>

git remote rm

rm
Remove the remote named .
All remote tracking branches and configuration settings for the remote are removed.

git remote prune

prune
Deletes all stale tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/". With --dry-run option, report what branches will be pruned, but do not actually prune them.