git:不能推送(解包错误)与权限问题有关 [英] git: can't push (unpacker error) related to permission issues

查看:85
本文介绍了git:不能推送(解包错误)与权限问题有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 错误:将对象添加到存储库数据库的权限不足./objects 

致命:未能写入对象
错误:解包失败:解包对象异常退出
至ssh://<回购网址> /<回购dir> ;
! [remote rejected] master - > master(n / a(unpacker error))
错误:未能将某些文件推送到'ssh://< repo url> /< repo dir>'

我偶尔会遇到这种情况,并且我们一直需要通过每个用户sshing来解决它,并设置其中所有文件的组权限

  chmod -R g + w * 

这绝不是一个令人满意的解决方案,现在它被我们扼杀在屁股中,因为其中一个人离开了,没有人知道他的回购用户的密码。所以,我正在努力解决它。

如果有人试图推动一项改变其他用户所拥有的回购目录的变更(因此设置上面的组写入选项),错误似乎就会发生。我已经做了一些Google搜索,并且发现了一些正在讨论的解决方案(这两种解决方案都不适合我)

1)确保组织回购目标是与每个用户的主要群组共享(我相信已经是这种情况了:每个用户只有一个组,因此它们必须是他们的主要组,对吧?)

2)git repo core.sharedRepository设置,详情请看这里: Git:无法从一台计算机推送
我改变了这一点,但没有任何区别。我需要重新加载配置或实际实现更改?

以下是我的repo配置看起来像atm:

  [core] 
repositoryformatversion = 0
filemode = true
bare = true
sharedRepository =全部
[接收]
denyNonFastForwards = True

感谢您的任何建议或建议!
max

解决方案

更简单的方法是添加运行chmod命令的post-receive脚本$每次推到服务器上的'hub'repo后b $ b。在服务器的git文件夹中添加以下代码到hook / post-receive中:

  chmod -Rf u + w / path / to / git / repo / objects 


I have this problem when i try to push in 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've had this before sporadically and we've always had to solve it by each user sshing to the repo and setting group permissions on all the files therein with

chmod -R g+w *

This was never a satisfactory solution and now it's bitten us in the arse as one of the guys is away and no-one knows his repo user's password. So, i'm trying to solve it properly.

The error seems to occur when someone tries to push up a change that will alter a repo dir that is owned by another user (hence setting the group write option above). I've done a bit of googling around this and have found a couple of solutions being discussed (neither of which worked for me)

1) make sure that the group that the repo dirs are shared with is each users' primary group (i believe that is the case already: each user has only one group so that must be their primary group, right?)

2) git repo core.sharedRepository setting, as detailed here: Git: Can't push from one computer I changed this but it didn't make any difference. Do i need to reload the config or something to actually effect the change?

Here's what my repo config looks like atm:

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

Grateful for any advice or suggestions! max

解决方案

A simpler way to do this is to add a post-receive script which runs the chmod command after every push to the 'hub' repo on the server. Add the following line to hooks/post-receive inside your git folder on the server:

chmod -Rf u+w /path/to/git/repo/objects

这篇关于git:不能推送(解包错误)与权限问题有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆