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


#1

Hello!

I was trying to git merge my dev branch with my master branch via the Glitch console.
But I got this error:
error: insufficient permission for adding an object to repository database .git/objects
fatal: git write-tree failed to write a tree

I only pushed some changes & after several pushes, I started to get the error above.
The git diff wasn’t showing the changes that I pushed to the repository, everything worked previously before this error…

Thanks ^^’


#2

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?


#3

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.


#4

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!


Git is not up to date
#5

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


#6

Looks good, thanks for your quick attention!


#7

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.


#8

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.


#9

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?


#10

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.


#11

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.


#12

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.


#13

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!


#14

Hi @5erban,

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


#15

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

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