Error while pull from git - insufficient permission for adding an object to repository database .git/objects

insufficient permission for adding an object to repository database .git/objects git pull
git objects/pack permission denied
git failed to read object permission denied
pushing requires write access and your access is read-only
github desktop insufficient permission
remote rejected master -> master (unpacker error)
git push error
error remote unpack failed: unable to create temporary object directory

I have git error: "insufficient permission for adding an object to repository database .git/objects" every time I make "git pull origin develop".

    remote: Counting objects: 70, done.
    remote: Compressing objects: 100% (7/7), done.
    remote: Total 42 (delta 35), reused 42 (delta 35)
    error: insufficient permission for adding an object to repository database     .git/objects

    fatal: failed to write object
    fatal: unpack-objects failed

Assuming @ChrisHayes is right about an accidental sudo, this should fix it. From inside your repository:

sudo chown -R $USER:$USER "$(git rev-parse --show-toplevel)/.git"

Update: for those of you getting the illegal group name error, try this instead:

sudo chown -R $(id -u):$(id -g) "$(git rev-parse --show-toplevel)/.git"

git pull error: “error: insufficient permission for adding an object to , git pull error: “error: insufficient permission for adding an object to repository database . git/objects” The error message indicates the problem itself, current user does not have insufficient permission to add objects to . git/objects folder. error: insufficient permission for adding an object to repository database .git/objects fatal: failed to write object fatal: unpack-objects failed I have tried various things toi change owner permission like this but no awail.

Go to project's root directory and run below commands to fix this issue,

cd .git/objects
sudo chown -R yourname:yourgroup *

insufficient permission for adding an object to repository , git/objects fatal: failed to write object fatal: unpack-objects failed error: Could not fetch origin ##[error]Process completed with exit code 1. Error: Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more git add . error: insufficient permission for adding an object to repository database .git/objects

Mine was a stupid mistake... the right username and group were set, but www-data was the account accessing it. The directory was owned by vaindil:www-data, but permissions were 755 so www-data couldn't write to it. Fixed it with:

$ sudo chmod -R 775 /path/to/repo

How to Fix GIT PUSH ERROR: insufficient permission for adding an , Insufficient permission for adding an object to repository database .git/objects. A fast way to fix this is to go in the project root folder and run the following terminal  When I try to push to a shared git remote, I get the following error: insufficient permission for adding an object to the repository database. Then I read about a fix here: Fix This worked for the next push since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder

remove .git from the url, if you are trying to clone a public repository from github.

example:

From: https://github.com/example/repository.git To: https://github.com/example/repository

Insufficient permission for adding an object to , I was trying to git merge my dev branch with my master branch via the Glitch Insufficient permission for adding an object to repository database .git/objects I only pushed some changes & after several pushes, I started to get the error above. I noticed it when I tried to pull my project to local, and realized HEAD was way  git push: insufficient permission for adding an for adding an object to repository database ./objects fatal: failed to write object error: unpack failed: unpack

NOT A GOOD PRACTICE (Just an alternative)

I am using Ubuntu and faced the same problem. To solve it, I simply switched user to root and I see no further error.

$su
password

Then,

$git pull origin master

Recommended way: CHANGE THE PERMISSION OF THE DIRECTORY

Git Push Error: insufficient permission for adding an object to , Git Push Error: insufficient permission for adding an object to repository database cd .git/objects So, if you do not fix the underlying cause, the error will keep coming sharedRepository is true or group, Git relies on a feature of GNU OSs git push all branches - set up git to pull and push all branches. when attempting to push changes to upstream I am faced with the following: git commit -m "init" [master (root-commit) ec6447c] init 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test $ git push Counting objects: 3, d

How to Fix Git Push Insufficient Permission Error for Objects , This error typically happens when multiple users are working on a p. How to Fix Git Push Insufficient Permission Error for Objects Permanently 0) error: insufficient permission for adding an object to repository database . Hello, Recently I have had problems pushing to any GitLab repo (new or old). I even tried setting up a new GitLab instance but always get the same error: Admin@Comp MINGW64 /c/Git/Test (master) $ git push origin master Counting objects:

T127093 error on tin:/srv/mediawiki-staging: insufficient permission , error on tin:/srv/mediawiki-staging: insufficient permission for adding an object to repository database .git/objects. Closed Trying to fetch changes down from gerrit to tin at /srv/mediawiki-staging and getting a permission denied error. Sometimes when you do a git push, you might get the following permission error message. This error typically happens when multiple users are working on a particular git repository. The following git push error indicates that it doesn’t have enough permission for adding a new object to the./objects directory under your repository.

remote: error: insufficient permission for adding an object to , Hello, I have an on premise installation based on docker of Bitbucket, I can create new repositories and clone them, both with ssh and https. remote: error: insufficient permission for adding an object to repository database I checked that: "sh git@bitbucket.se.local -p 7999 whoami" gives the correct user. Which is weird. I am running as the user that owns the .git dir, all the permissions recursively down are the same (user:user), the file that won't add is in a dir owned user:user, the file that won't add is owned user:user, and all the other files in the dir (and every other dir) add just fine.

Comments
  • Obvious question: Do you have access rights to the files on disk?
  • Check the permissions of the .git/objects file. It sounds like you may have mistakenly used sudo at some point in the past and given ownership to root rather than to yourself.
  • I'm getting the same problem @ChrisHayes But which .git/objects file? Where is that file/directory?
  • @pedroremedios .git is a directory which exists at the base of every git repo.
  • What does git rev-parse --show-toplevel do? I was able to fix the issue just by using chown -R user:user on the top-level directory of my repo.
  • @MattK this will get the top-level directory of your repo, so the command will work regardless of where in your repo you currently are. If you're already in the root you can just run sudo chown -R $USER:$USER .git
  • I get: illegal group name
  • I was using the wrong username. The command worked. Thank you.
  • it also happened to me after an accidental sudo before. changing the owner/group fixed it
  • This will work (as will sudo), but it is best practice to avoid running commands as root wherever possible.
  • @dwurf Thank you for the comment. It was just an alternative to the answer above. :)
  • NOT A SOLUTION as well - you dont want to use your repo as sudo.
  • @WaxCage Yes, but do you see the big bold text already there? :)