我怎样才能一次删除多个 git 遥控器

how can I remove several git remotes at once

合并几个 git 存储库后(按照本教程)我现在有 40 个左右的遥控器。

我现在想一次性全部删除。

我想我可以用 xargs 做到这一点,就像这样:

git remote | xargs git remote remove

但它似乎不起作用。

有什么建议吗?

最简单的方法就是编辑文件 .git/config 并删除文件中的行。
每个遥控器都应该在文件中有它的条目,如果使用 vi/vim DD 将删除这些行。

如果您仍然坚持使用 xargs 删除它们,请添加 -n 标志:

# get the list of all the remotes and remove them using the
# git remote remove command
git remote | xargs -n 1 git remote remove

xargs -n

-n number Set the maximum number of arguments taken from standard input for each invocation of utility.

所以在你的情况下,它们应该被一个一个地删除