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. http://git.661346.n2.nabble.com/file/n7562253/Git_Problem.png 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.. http://git.661346.n2.nabble.com/file/n7562253/Git_Problem_2.png -- View this message in context: http://git.661346.n2.nabble.com/Failed-to-lock-refs-heads-master-tp7562253.html Sent from the git mailing list archive at Nabble.com. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html