Insufficient permission for adding an object to repository database .git/objects

We used to have a bug that set the ownership of some files incorrectly and caused this problem. How old is your project?

What git commands are you running? What’s the name of the project?

Hello Tim!
I created the project yesterday evening, but it seems that I can git merge again.

I was running git merge dev on the discord-pizza project.

Hey @Tim, it looks like I’m having the same problem mentioned in this thread in my project web-sonify. I noticed it when I tried to pull my project to local, and realized HEAD was way behind, so when I brought up the glitch console to commit (there are a lot of unstaged changes, untracked files), I get this:

$ git add -A
error: insufficient permission for adding an object to repository database .git/objects
error: src/index.js: failed to insert into database
error: unable to index file src/index.js
fatal: updating files failed

Doing some research online, I see this might be caused by a permissions problem in .git/objects, so trying to fix things I get:

$ chmod -R g+rwX .
chmod: changing permissions of './.git/objects/pack/pack-31dffcfa5f0ea052845583fc6e1d0f8fb0034d04.pack': Operation not permitted
chmod: changing permissions of './.git/objects/pack/pack-31dffcfa5f0ea052845583fc6e1d0f8fb0034d04.idx': Operation not permitted
chmod: changing permissions of './.git/objects/e5': Operation not permitted

and maybe 100 more lines. I realize that this might be by design.

My project is quite old, but it looks like the last successful commits were pushed from local, so totally possible that I caused this problem myself.

Anything I can try? Thanks!

I updated the permissions in your .git directory. Let me know if that takes care of it or not.

Looks good, thanks for your quick attention!

Hey there @Tim. Sorry to bug you again, but I don’t think I touched anything substantial since you made this change, and now my project is not building, with

Error: ENOSPC: no space left on device, write

I had a fairly large assets folder, and thinking that might be the cause, I renamed .glitch-assets as per @Gareth’s advice here, but I still have that disk space error. My dependencies should be pretty minimal, so I’m at a bit of a loss.

Thanks in advance.

The assets folder in Glitch is a virtual folder and is not part of your local filesystem. Consequently, it doesn’t count towards your project space quota, so it won’t be the cause.

It’s likely the size of your .git folder that’s taking up the space. Follow the instructions here (https://glitch.com/help/when-i-try-to-edit-a-project-it-just-refreshes-and-doesnt-save-my-changes/) to get your project functional again and then look to remove unneeded files and .gitignore any frequently changing data files by adding them to the .gitignore file or moving them into a folder called .data.

Hey @Gareth, that was indeed the problem. In fact the device appeared to be so full that I wasn’t even able to prune. I solved it by just rm -rf .git/ (moving the .git/config first, and then restoring it after; losing the history is ok for me at this point). This seemed to solve the problem temporarily, but every few days the git folder appears to fill up my project again and I have to blow it away again to make the project build again.

Thoughts?

If it’s filling up that fast, you’re probably adding some kind of binaries to the repository. You can use .gitignore to exclude those files, and then it should grow only when your code changes.

Hi! I’m running into the same problem. As far as I understood, it’s a permission issue…? Is there any way this can be fixed? Merging doesn’t work anymore. My current solution is to simply switch branches in the console and build on that.

I ran into this problem earlier today on the project pizza-canary…
This permission problem isn’t that rare today and needs to be fixed.

We are actively working to fix this issue :slight_smile: some projects might still have it though, sorry for the inconvenience :frowning:

pizza-canary is now fixed and should work fine!

Hi @5erban,

we can fix your project if you tell us the project name!

Hi! The project is tar-fruit. Thanks for the help!

În dum., 4 nov. 2018, 11:46 Emanuele Tamponi <hyperweb@discoursemail.com a scris:

Hi! I’m having the same problem with my project kiquerangelb-gac-telegram-bot. Is there a way to fix it from the user’s side?

Hi @denyncrawford, welcome to the Glitch Forums!

After taking a quick look at your project it doesn’t appear to be the victim of the same bug the early posts in this topic were. Can you tell us exactly what you were doing to trigger the error and exactly what the error message was?

Hello @cori!

Yes, I’m not having this problem, I was committing to the master branch from the console, but it’s already fixed … Now it shows me the following error message when I merge:

Auto-merging .gitignore
CONFLICT (content): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.

I can only fix it by editing the .gitignore file in my project, and then when I try to merge again, the console gives me the following error message:

$ git merge public
fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you merge.

And then the only thing I could do is commit to the main branch and this returns the permission error:

$ git commit
error: insufficient permission for adding an object to repository database .git/objects
error: insufficient permission for adding an object to repository database .git/objects
error: Error building trees

What can I do to solve it? I may be wrong with something (probably), I do not have much experience with git …

But anyway, thank you very much for your time.

77/5000

Now I realize that I get a permissions problem when doing git add . too.

$ git add .
error: insufficient permission for adding an object to repository database .git/objects
error: .gitignore: failed to insert into database
error: unable to index file .gitignore
fatal: updating files failed

I have no idea what I’m doing but do you have a .gitignore file? Might be best to have one, ofc I don’t know if this is the issue

@denyncrawford I think the issue might be that your git repo is stuck in the midst of a merge as you noted above. If you run git status in the console the resulting message will probably tell you as much. To get out of that situation, run git merge --abort in the console and you’ll abandon your merge and can start again.

Let us know if this helps, and happy Glitching!