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…
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.
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.
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.
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.
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?
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 …
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