Pushing to a shared bare repo on a server fails with `error: insufficient permission for adding an object to repository database ./objects`.
IntermediateTroubleshootingRepository Health, Size and Performance
Answer
Likely causes → Several Unix users push over SSH to the same bare repo, and someone created object directories with a private umask (or ran Git as root), so others cannot write there.
Diagnose →
ls -ld /srv/git/app.git/objects/*/ | awk '{print $1, $3, $4}' | sort | uniq -c
git -C /srv/git/app.git config core.sharedRepository
Fix →
cd /srv/git/app.git
git config core.sharedRepository group
sudo chgrp -R developers .
sudo chmod -R g+rwX .
sudo find . -type d -exec chmod g+s {} +
Prevent → Create shared repos with git init --bare --shared=group, never operate on them as root, and prefer a Git server (GitHub, GitLab, Gitea) over raw shared accounts.
More on Repository Health, Size and Performance
`git status` takes 8–15 seconds in a large monorepo.Intermediate`error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log` followed by `warning: There are too many unreachable loose objects; run 'git prune' to remove them.`IntermediateEvery few commands Git prints `Auto packing the repository in background for optimum performance.` and the machine stutters.BeginnerA fresh clone downloads 4 GB, but the checked-out files are only 200 MB.Intermediate`git gc` or `git clone` dies with `fatal: Out of memory, malloc failed (tried to allocate 1073741824 bytes)` or `error: pack-objects died of signal 9`.Advanced`error: unable to create temporary file: No space left on device` followed by `fatal: failed to write object`.Beginner