gpt4 book ai didi

Git 从本地存储库中删除上游

转载 作者:IT王子 更新时间:2023-10-29 00:34:51 25 4
gpt4 key购买 nike

我正在使用 ruby​​ on rails 应用程序,我正在尝试同步一个分支。值得一提的是,我也是在 Mac 上。我执行了以下操作:

$ git remote -v

查看我的本地存储库。我在尝试去 upstream 时搞砸了:

$ git remote add upstream https://github.com/foo/repo.git

什么时候我应该将 Foo 大写:

$ git remote add upstream https://github.com/Foo/repos.git

问题是我如何删除 upstream 因为每次我尝试更改它时它都会返回创建一个 fatal 错误?

最佳答案

使用 git 版本 1.7.9.5 没有远程的“删除”命令。请改用“rm”。

$ git remote rm upstream
$ git remote add upstream https://github.com/Foo/repos.git

或者,如前一个答案所述,set-url 有效。

我不知道命令何时更改,但 Ubuntu 12.04 随 1.7.9.5 一起提供。

编辑:有些人似乎遇到了没有“上游” Remote 的情况。执行 cat .git/config 并查看 Remote 的名称。 (如果在 Windows 上并且不使用 powershell,您可以使用 type .git/config。)

输出将显示为您的 git 仓库配置的 Remote ,例如,

[remote "origin"]

将您要删除的 Remote 的名称替换为:

$ git remote rm origin

如果您没有“上游” Remote ,则无法将其移除。

关于Git 从本地存储库中删除上游,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19801455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com