无法锁定参考/头/主 [英] Failed to lock refs/heads/master

查看:287
本文介绍了无法锁定参考/头/主的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,并且正面临着这个问题。 git push命令显示下面的错误。从开始我会向你解释我一直在努力做什么。
我创建了一个子模块,提交并推送它。推送引发下面的错误。

  Salman @ PC_HOME〜/ git / breakit-web-app(master)
$ git push origin master
错误:refs / heads / master不指向有效的对象!
计数对象:4,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(3/3),完成。
写入对象:100%(3/3),421字节,完成。
总计3(增量1),重用0(增量0)
远程:bb / acl:salmanmanekia是允许的。接受有效载荷
错误:Ref refs / heads / master位于6a47a0fd398610a75bdab8976f842dc0efd89f86,但预期为00000000000000000000000000000000000000000
remote:错误:未能锁定refs / heads / master

至ssh:// git @ bitbucket .org / majuri / breakit-web-app.git
! [remote rejected] master - > master(未锁定)
错误:无法将某些参考文献推送到'ssh://git@bitbucket.org/majuri/breakit-web-app.git'

以下是一个截图:



之后,我尝试了一些解决方案,但都没有工作。我也会解释一下,我一直在试图从bbuck回购库中注意到有一些悬而未决的提交(图2中的红色箭头),所以我给了以下命令解决
git gc和git prune。


2:我也尝试过像git revert HEAD和git push origin HEAD --force这样的命令,但似乎没有任何效果。



其他细节:

  $ git rev-parse --symbolic-full-name master 
refs / heads / master

$ git rev- parse master
0da090c5cbde10ff19602a2722ae05231c30dff5
$ b $ git show-ref master
0da090c5cbde10ff19602a2722ae05231c30dff5 refs / heads / master
6a47a0fd398610a75bdab8976f842dc0efd89f86 refs / remotes / origin / master

谢谢

解决方案

Can您可以尝试以下命令:



1 - 转至 master 分支

  git checkout master 

2 - 从远程获取更新到本地存储库

  git fetch 

3 - 使用rebase而不是merge来更新您的本地存储库。请参阅 git pull git rebase 之间的区别。 code>

  git rebase origin / master 


$ b

4 - 将您的主分支分支

  git push origin master:master 


I am relativly new to git and am facing this problem. The git push command shows the error below. I will explain to you from the begining what i had been trying to do . I created a submodule, commited and pushed it. The push throws the error below.

Salman@PC_HOME ~/git/breakit-web-app (master)
$ git push origin master
error: refs/heads/master does not point to a valid object!
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 421 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: bb/acl: salmanmanekia is allowed. accepted payload.
error: Ref refs/heads/master is at 6a47a0fd398610a75bdab8976f842dc0efd89f86 but expected 00000000000000000000000000000000000000000
remote: error: failed to lock refs/heads/master

To ssh://git@bitbucket.org/majuri/breakit-web-app.git
 ! [remote rejected] master -> master (failed to lock)
error: failed to push some refs to 'ssh://git@bitbucket.org/majuri/breakit-web-app.git'

Here is a screen shot:

After that i tried some solutions but none of them worked. I will also explain breifly what i have been trying

1 : From the bitbucket repo i noticed there are some danggling commits (the red arrow in picture 2) so i gave the following commands to solve that git gc and git prune.

2: I also tried commands like git revert HEAD and git push origin HEAD --force but none seem to worked..

Other details:

$ git rev-parse --symbolic-full-name master
refs/heads/master

$ git rev-parse master
0da090c5cbde10ff19602a2722ae05231c30dff5

$ git show-ref master
0da090c5cbde10ff19602a2722ae05231c30dff5 refs/heads/master
6a47a0fd398610a75bdab8976f842dc0efd89f86 refs/remotes/origin/master

Thank you

解决方案

Can you try the following commands

1 - Go to master branch

git checkout master

2 - Get updates from the remote to your local repository

git fetch

3 - Update your local repository using rebase instead of merge. See there difference between git pull and git rebase

git rebase origin/master

4 - Push your master branch

git push origin master:master

这篇关于无法锁定参考/头/主的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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