Pushing to a remote branch (failed to update ref)

狂风中的少年 提交于 2019-12-04 07:33:56

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!