分支存在于本地和github上,但不能推送



首先,我为有这样一个愚蠢的问题道歉;但是git似乎是一种永远存在的东西,所以所有的文档似乎都假定了一些知识。我目前正在阅读Gitpro,看看是否存在解决方案,但我想我也会在这里提问。

注意:一些名称已更改,但所有格式都是正确的

因此,我有一个名为fitnet的github存储库,位于https://github.com/Jose/Fitnet它有三个分支:masterdevstaging,具有以下url。

我已经在github网站上验证了这些存在。

master:         github.com/Jose/Fitnet/Tree/master
fitnetdev:      github.com/Jose/Fitnet/tree/fitnetdev
fitnet_Staging: github.com/Jose/Fitnet/tree/fitnet_staging

在本地,我有以下分支机构:

  • fitnet_stage
  • fitnetdev
  • 船长

我在本地有这些遥控器:(通过gitremote-v)

Master               https://github.com/Jose/Fitnet (fetch)
Master               https://github.com/Jose/Fitnet (push)
fitnet_staging       https://github.com/Jose/Fitnet/tree/fitnet_staging (fetch)
fitnet_staging       https://github.com/Jose/Fitnet/tree/fitnet_staging (push)
fitnetdev            https://github.com/Jose/Fitnet/tree/fitnetdev (fetch)
fitnetdev            https://github.com/Jose/Fitnet/tree/fitnetdev (push)

我使用c:\fitnet 上的git Init在命令行上创建了所有这些分支

然而,当我尝试时:

git push fitnet_staging fitnet_staging

,我收到一个错误,上面写着:

C:Fitnet>git push fitnet_staging fitnet_staging
fatal: https://github.com/Jose/Fitnet/tree/fitnet_staging/info/refs?service=git-receive-pack not found: did you run git update-server-info on the server?

我确信我在这里错过了一些非常基本的东西,这是你们所有git专家的老手,所以,我再次为问这样的问题道歉。

非常感谢

您不必添加单独的分支作为远程。在git中,一个存储库相当于一个远程存储库,反之亦然。一个存储库本身可以包含多个分支,所有分支都可以使用同一个远程访问。

所以,为了解决您的问题

  1. 清除当前存储库中的所有遥控器。为此,您可以在本地存储库中编辑.git/config文件,并删除所有相应的标记条目,如[remote ""]

  2. 接下来,在本地repo中,使用以下命令将远程github添加到本地repo:

    git remote add github https://github.com/Jose/Fitnet
    
  3. 最后,您可以从本地回购推送到github,如:

    git push github fitnet_staging
    

相关内容

最新更新