首页 > 解决方案 > 在 gitlab 中删除上游仓库

问题描述

我有一个工作要求基本上重新设计我们的 gilab 存储库。为了促进这一点,我正在尝试编写脚本。为此,我需要从命令行删除并创建远程存储库。

我做了一些基础研究,发现了 git remove 命令。我这样做是为了获取原始网址:

git config --get remote.origin.url

然后用它来删除:

git remote remove git@gitlab.work.com:Michael/myrepo.git

但我收到此错误:

fatal: No such remote: git@gitlab.work.com:Michael/myrepo.git

我不明白这是怎么回事,因为我只是问远程仓库是什么。我也试过

https://gitlab.work.com:Michael/myrepo.git

还有其他几个变体,但还没有做好。有任何想法吗?

标签: git

解决方案


git remove采用远程名称,而不是 URL。

$ git remote -v
origin  https://githubm.com/blah/blah (fetch)
origin  https://githubm.com/blah/blah (push)

$ git remote remove origin

推荐阅读