Git: cannot click (error during unpacking) related to permission problems

I have this problem when I try to click git:

error: insufficient permission for adding an object to repository database ./objects fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To ssh://<repo url>/<repo dir> ! [remote rejected] master -> master (n/a (unpacker error)) error: failed to push some refs to 'ssh://<repo url>/<repo dir>' 

I had this until sporadic time, and we always had to solve it with each sshing user for the repo and set group permissions for all files in it using

 chmod -R g+w * 

This was never a satisfactory solution, and now he bit us in the ass when one of the guys left and no one knows the password of his repo. So, I'm trying to solve this correctly.

The error occurs when someone tries to undo a change that will change the repository owned by another user (therefore, setting the group recording option above). I worked a bit on this and found a couple of solutions discussed (none of them worked for me)

1) make sure that the group to which the repositories belong is the main group of users (I believe that this is already so: each user has only one group, so it should be their main group, right?)

2) git parameter repo core.sharedRepository, as described here: Git: it is impossible to click from one computer I changed this, but it did not matter. Do I need to reload the configuration or something to really affect the change?

Here my repo configuration looks like atm:

 [core] repositoryformatversion = 0 filemode = true bare = true sharedRepository = all [receive] denyNonFastForwards = True 

Thanks for any advice or suggestions! Max

+44
git linux
Oct 26 '10 at 16:25
source share
12 answers

An easier way to do this is to add a post-receive script that runs the chmod command after each click on the repo hub on the server. Add the following line to intercept / send messages inside your git folder on the server:

 chmod -Rf u+w /path/to/git/repo/objects 
+24
Jan 24 '11 at 23:50
source share
β€” -

I had this error for two weeks and most of the solutions stated β€œchmod -R” as the answer, unfortunately for me my git repositories (local / remote / shared with the command) were on Windows OS, and although chmod is Rv showed all the files changed to "rwxrwxrwx", the subsequent "ls -l" still showed all the files as "rwxr-xr-x", and the error repeated itself. In the end, I saw this solution from Ariejan de Vroom. It worked, and we were all able to pull again and again.

On the local (local, which causes trouble) and remote repositories, run the following commands:

 $ git fsck $ git prune $ git repack $ git fsck 

On the other hand, I tried to use my own permissions to access Windows / ACL files and even resorted to raising the user problem to the administrator, but none of this helped. I'm not sure that the environment is important, but it can help someone with a similar setup - a team member and remote (Windows Server 2008 R2 Standard), my local (Windows 7 VM).

+12
Aug 12 '13 at 21:26
source share

This is a permission error. What was most suitable and safe for me was adding users to an additional group that repo. belongs to (or vice versa):

 groupadd git chgrp -R git .git chgrp -R git ./ usermod -G -a git $(whoami) 
+8
Sep 18 '12 at 3:14
source share

If someone else is stuck with this: it just means writing permissions to the repos that you click. Go and chmod -R so that the user you accessed the git server has write access.

http://blog.shamess.info/2011/05/06/remote-rejected-na-unpacker-error/

It just works.

+5
Sep 04
source share

I use gitosis to manage such things. Gitosis has one user (usually called "git") who owns all the repositories, and uses public key access control for each repo. This may not suit your settings, but it is probably worth checking out (no pun intended).

+2
Oct 26 2018-10-26
source share

For me, this error occurred when I was absent on my remote control.

I just needed to read the rest of the error message:

 error: file write error (No space left on device) fatal: unable to write sha1 file error: unpack failed: unpack-objects abnormal exit 
+2
May 11 '16 at 12:47
source share

I also had problems with this, thinking that my remote guitarolite admin was damaged or something was wrong.

My setup is a Mac OS X (10.6.6) laptop with a remote Ubuntu 10 server with guitar.

It turned out that the problem is related to my local gitolite-admin check.

Despite the error "unpack failed", it turned out that the problem was local.

I figured this out by checking it again as gitolite-admin2, making changes and clicking.

Voila! It worked!

+1
Apr 20 2018-11-21T00:
source share

This issue may also occur after upgrading Ubuntu requiring a reboot.

If the file /var/run/reboot-required exists, run or schedule a restart.

+1
Jan 24 '13 at 12:09
source share

For what it's worth, I had the same problem compared to my own VPS, and it was caused by my low disk space on the VPS. Confirmed by the df -h command and after I cleaned the VPS hard drive; the problem is gone.

Greetings.

+1
Dec 22 '14 at 10:02
source share

For me, this is a permissions issue:

On git server, run this command in the repo directory

 sudo chmod -R 777 theDirectory/ 
+1
Jan 04 '16 at 16:38
source share

I got a similar error, and please see below how I resolved it.

My directory structure: / opt / git / project.git and git user git

 $ cd /opt/git/project.git $ sudo chown -R git:git . 

chown with the -R option recursively changes the ownership and group (since I typed git: git in the above command) of the current directory. chown -R is necessary since git modifies many files inside your git directory when you click on the repository.

0
Nov 14 '13 at 0:26
source share

Where I work, we used this method in all of our repositories for several years without any problems (except when we create a new repository and forget to configure it this way):

  • Set 'sharedRepository = true' in the [core] section of the configuration file.
  • Change the group identifier in the repository to a group that is common for all users who are allowed to click on it:

     chgrp -R shared_group /git/our_repos chmod -R g+w /git/our_repos 
  • Set the setgid bit in all directories in the repository so that new files / directories keep the same group:

     find /git/our_repos -type d -exec chmod g+s {} + 
  • Add this line to the pre-receive hook in the repository to ensure that new file permissions allow the group to read / write:

     umask 007 
0
Jun 10 '14 at 18:13
source share



All Articles