Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

'git apply' failed with code 128:'fatal: Unable to create '/Users/.../.git/index.lock': Permission denied '

Running Sourcetree 2.0.3 on Mac OSX 10.10.1 and attempting to commit a change. When I click the Stage hunk button I receive the error:

'git apply' failed with code 128:'fatal: Unable to create '/Users/.../.git/index.lock': Permission denied'

I cannot commit changes.

I am able to do this through Terminal if a add sudo. My guess it is a permissions thing somewher, but I cannot figure it out.

Any help will be greatly appreciated.

1 answer

1 accepted

0 votes
Answer accepted
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 21, 2014

Check the ownership of the .git folder. It should be writable by your user. If that is not the problem, check whether the index.lock file exists, and you may need to delete the lock file manually, but only if you're sure git isn't performing any operations (shut down sourcetree to avoid colliding with automatic fetches).

Thank you, Seth.

That allowed me to attempt the commit. When I did I received a message regarding permissions being denied to COMMIT_EDITMSG.
I changed that in Terminal and then received this error:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/13/7_nt5m7x6zv4v0f5cftwvry40000gp/T/SourceTreeTemp.epR05C 

error: insufficient permission for adding an object to repository database .git/objects

fatal: failed to write commit object

Completed with errors, see above

When I look at these items in terminal they are all owned by root, but not my user. Why is this? Can I change all he ownership under .git to my user with 'chown -R'?

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 22, 2014

I think that should work, but my knowledge is based on linux, not Mac, so you may want to get a second opinion before attempting that. If everything is owned by root, it's likely that the command you used to create them (git clone?) was executed as root (probably via sudo, based on reference to that in your question). In practice, I would avoid using the "sudo" command in your user's directory for any operation other than changing ownership to your user.

Thanks Seth. 

I did try this and it worked. Thanks for the warning about sudo.

Jedidiah

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 24, 2014

Glad to help. If you hit the checkbox by my answer, that will highlight it as the "correct" answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events