Git merge error – Permission denied
Posted by Jens Pettersson on August 20th, 2010Today when I wanted to merge my branch (after the “pull –> rebase dance” I wrote about yesterday) I got the following error:
error: git checkout-index: unable to create file src/ProjectName/ClassName.cs (Permission denied)
If I just retried the merge I got another error and if I looked in my local master I didn’t see my branch’s commit messages either. If I did a git status I saw some of my files from my branch, but not all of them as untracked files. I couldn’t go back to my other branch either due to the untracked files in my master.
The solution? Well, it turned out that a
§ git checkout my_branch -f
did the trick. The –f stands for “force” so it just discarded all my untracked changes in master and I was back on track. Now the merge worked again because the file probably wasn’t locked anymore.
Not sure why the file was locked and by what, but this workaround did enable me to merge and later push my changes correctly to github.
//J
Recent Comments