Date
Oct. 26th, 2024
 
2024年 9月 24日

Post: Git Error: insufficient permission for adding an object to repository database .git/objects

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

Published 12:09 Sep 16, 2015.

Created by @ezra. Categorized in #Version Control, and tagged as #Git.

Source format: Markdown

Table of Content

今天提交 Git 的时候出现一个错误,来看一下:

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

看字面意思是权限不完全,第一个想法是 chmod:

chmod -R 755 ~/Meniny.github.io

这里是将 ~/Meniny.github.io 权限设置为 755 ,也就是rwxr-xr-x ,其中 -R 表示其子路径的文件(夹)也将继承该权限。 提示是这样的:

chmod: Unable to change file mode on /Users/Meniny/Meniny.github.io/.git/objects/38/3e9005dd5092845436e91d5f3c5d52309a3219: Operation not permitted

问题出在哪里呢?我想到了 sudo -s:

sudo -s

回车,无异常,重新 chmod

chmod -R 755 ~/Meniny.github.io

接着用 addcommitpush,OK 无异常。

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
开发、设计与写作皆为所长。
热爱苹果、钟情色彩。
随时恭候 垂询