【问题标题】:Delete Repository删除存储库
【发布时间】:2021-07-06 18:19:36
【问题描述】:

我的 git 有问题:

我在 GitHub 上创建了一个 repo 来将那个 repo 推送到 GitHub 但是因为我没有仔细研究,我在 GitHub 上删除了那个 repo。

然后我创建了另一个仓库并使用了 git add 但出现了错误:

error: remote origin already exists.

我使用 git remote -v 来查看 url 列表并且仍然有旧的 repo。

然后我使用:git remote set-url <an-existing-remote-name> <url> 来替换新的 repo。
但是我不记得以前repo的远程名称了

那么我该如何删除/替换旧的 repo?

【问题讨论】:

  • 我不太明白这个问题。 远程名称 是类似origin 的字符串。 origin 名称的特殊之处仅在于 git clone 在您运行 git clone 时为您创建它。此处允许使用任何简单的字母文本字符串:您可以编造它们。每个遥控器附带的 URL 当然只是一个 URL;您需要记住正确的 URL,直到将它们保存在某个远程名称下。

标签: git github repository git-remote


【解决方案1】:

比我使用:git remote set-url 替换新的 repo。
但是我不记得以前repo的远程名称了

您不必:使用origin:这将覆盖之前的原始 URL

git remote set-url origin https://github.com/<me>/MyNewRepository

然后你就可以开始推送到你的新仓库了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-09
    • 2016-01-22
    • 1970-01-01
    • 2012-11-28
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 2019-05-27
    相关资源
    最近更新 更多