推送到远程分支(未能更新参考) [英] Pushing to a remote branch (failed to update ref)

查看:500
本文介绍了推送到远程分支(未能更新参考)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有特性/初始化更改分支的远程存储库。现在我想从本地特性/初始化更改分支中将一些文件推送到这个远程分支。



我在推送远程分支时尝试了几个帖子,并尝试了一些方法,但我仍然得到相同的错误。

  Sakibs-MacBook-Pro:BluFireLabs SakibArRahman $ git status $ b在添加并提交后,我获得了以下git状态。 $ b在分支功能/初始更改
您的分支在1次提交之前领先于'origin / feature / initial-change'。
(使用git push发布你的本地提交)
没有提交,工作目录干净

但是当我推送时,我得到以下内容:

  Sakibs-MacBook-Pro:BluFireLabs SakibArRahman $ git推送原点功能/初始更改
计数对象:255,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(141/141),完成。
写作对象:100%(255/255),6.57 MiB | 1.88 MiB / s,完成。
共255(增量49),重用13(增量5)
远程:错误:无法更新ref'refs / heads / feature / initial-change':无法创建日志目录/ refs /头文件/功能/初始更改:无此文件或目录
至git@bitbucket.org:bluefirelabs / fire-voice-droid.git
! [远程拒绝]功能/初始更改 - >功能/初始更改(无法更新参考)
错误:未能将某些参考文献推送到'git@bitbucket.org:bluefirelabs / fire-voice-droid.git'

关于如何解决这个问题或我做错什么的想法?提前致谢!

解决方案

创建两个分支时会发生这种情况,其中一个斜杠 / ,另外一个没有斜杠,其中没有斜杠的分支是另一个分支的前缀。



示例



考虑这两个有效的分支名称:




  • 特征

  • 功能/初始更改



<当你从远程获取这些分支到本地机器时,特性分支被表示为一个文件,而特性/初始更改 code> branches被表示为名为 feature 的目录和名为 initial-change 的文件。您的操作系统无法创建同名的文件和目录:


  • logs / refs / heads /
  • logs / refs / heads / feature / initial-change

  • ul>

    解决方法



    解决方法是删除功能分支在这种情况下:

      git push --force来源:功能


    I have a remote repository with a feature/initital-change branch. Now I want to push some files to this remote branch from my local feature/initital-change branch.

    I went through a few posts on pushing to remote branches and tried out a few methods but I am still getting the same error. After adding and committing, I get the following for git status.

    Sakibs-MacBook-Pro:BluFireLabs SakibArRahman$ git status
    On branch feature/initial-change
    Your branch is ahead of 'origin/feature/initial-change' by 1 commit.
      (use "git push" to publish your local commits)
    nothing to commit, working directory clean
    

    But when I push, I get the following:

    Sakibs-MacBook-Pro:BluFireLabs SakibArRahman$ git push origin feature/initial-change
    Counting objects: 255, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (141/141), done.
    Writing objects: 100% (255/255), 6.57 MiB | 1.88 MiB/s, done.
    Total 255 (delta 49), reused 13 (delta 5)
    remote: error: Cannot update the ref 'refs/heads/feature/initial-change': unable to create directory for logs/refs/heads/feature/initial-change: No such file or directory
    To git@bitbucket.org:bluefirelabs/fire-voice-droid.git
     ! [remote rejected] feature/initial-change -> feature/initial-change (failed to update ref)
    error: failed to push some refs to 'git@bitbucket.org:bluefirelabs/fire-voice-droid.git'
    

    Any idea on how I can fix this or what I am doing wrong? Thanks in advance!

    解决方案

    This can happen when two branches are created, one with a slash / and one without a slash, where the branch without the slash is the prefix of the other branch.

    Example

    Consider these two valid branch names:

    • feature
    • feature/initial-change

    When you fetch these branches from the remote to your local machine the feature branch is represented as a file and the feature/initial-change branches is represented as a directory named feature and a file named initial-change. Your OS cannot create a file and directory of the same name:

    • logs/refs/heads/feature
    • logs/refs/heads/feature/initial-change

    Workaround

    The workaround would be to delete the feature branch in this case:

    git push --force origin :feature
    

    这篇关于推送到远程分支(未能更新参考)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆