Git推问题 - 全部 [英] Git problems with git push --all

查看:139
本文介绍了Git推问题 - 全部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基础存储库,它位于UNC \ machine \share ....等。
我有一个本地克隆,我在master分支上工作,偶尔会合并到stable分支。

I have a base repository that lives on a UNC \machine\share ....etc. I have a local clone that I work on in the master branch and occasionally merge over to the "stable" branch.

通常我会执行
git push --all

将所有分支中的所有更改移至服务器。在创建一个新分支
git branch MultiCompany

to move all changes in all branches up to the server. After creating a new branch git branch MultiCompany

然后将其推送到服务器
git push --all

and then pushing it to the server git push --all

它也会在服务器上创建分支。我做了一些工作,完成了multicompany分支的所有更改,然后尝试执行
git push --all

which creates the branch on the server also. I did some work, committed all the changes in multicompany branch and then tried to do a git push --all

,并得到以下错误:

and got the following error:

cdturner@OAHU ~/desktop/git sourcetree/maerekai.web.framework (multicompany) 
$ git push --all
Counting objects: 28, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (23/23), 11.34 KiB, done.
Total 23 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
error: Ref refs/heads/multicompany is at bd5a32df35ce8d5ae30ce999af34c4c5f35581df but expected 0000000000000000000000000000000000000000
remote: error: failed to lock refs/heads/multicompany
To //pluto/users/cdturner/Git repositories/Maerekai.web.framework.git
 ! [remote rejected] multicompany -> multicompany (failed to lock)
error: failed to push some refs to '//pluto/users/cdturner/Git repositories/Maerekai.web.framework.git'

我尝试用 git reset --hard HEAD ^

,然后重新尝试.....

and then retried the push.....

cdturner@OAHU ~/desktop/git sourcetree/maerekai.web.framework (multicompany)
$ git push --all
Total 0 (delta 0), reused 0 (delta 0)
error: Ref refs/heads/multicompany is at bd5a32df35ce8d5ae30ce999af34c4c5f35581df but expected 0000000000000000000000000000000000000000
remote: error: failed to lock refs/heads/multicompany
To //pluto/users/cdturner/Git repositories/Maerekai.web.framework.git
 ! [remote rejected] multicompany -> multicompany (failed to lock)
error: failed to push some refs to '//pluto/users/cdturner/Git repositories/Maerekai.web.framework.git'`

推荐答案

为了记录,我相信造成这个问题的根本原因是本地和远程分支名称以及承载远程存储库的Windows共享的不区分大小写的属性。

For the record, I believe the root cause of this problem was the difference in capitalisation between the local and remote branch names, and the case-insensitive nature of the Windows share that hosted the remote repository.

我们刚刚遇到了完全相同的错误,只能通过简单地解决问题重命名本地分支以匹配现有远程分支的大写。

We just encountered this exact same error and were able to resolve the problem simply by renaming the local branch to match the capitalisation of the existing remote branch.

请参阅如何重命名本地分支

在Windows中,由于大写,您可能需要执行两个步骤:

In Windows, due to capitalization, you may need to take two steps:

git branch -m example foo
git branch -m foo EXAMPLE

这篇关于Git推问题 - 全部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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