Ludi
Ludi

Reputation: 109

GIT | What causes git error: 'fatal: Unable to create '/index.lock': Permission denied' error?

I have a question that I can't answer myself, even with the Uncle Google's help.

While I try to use 'git checkout' command in one of my projects I got error like this:

'fatal: Unable to create *'some/directory/path/index.lock'*: Permission denied'

I am aware that this issue is related to permissions inside .git directory. What I would like to know is what actions are leading to such situation and how to prevent them in the future.

TL;DR What causes 'fatal: Unable to create '/index.lock': Permission denied' error?

Upvotes: 5

Views: 12098

Answers (2)

Sameh.K
Sameh.K

Reputation: 1153

In ubuntu Os I added sudo before the command like that

sudo git checkout branch_name 

and it worked.

Upvotes: 0

bixel
bixel

Reputation: 1581

I can't add comments yet, but The who's comment on this git index.lock File exists when I try to commit, but cannot delete the file question might be an answer.

I think he's right, that another process interferes with the git repo.

Upvotes: 2

Related Questions