当我尝试推到共享git远程时,我得到以下错误: 向存储库数据库添加对象权限不足

这适用于下一次推送,因为所有的文件都属于正确的组,但下一次有人推送一个更改时,它会在对象文件夹中创建一个新项目,该项目的默认组为组。我唯一能想到的就是改变所有开发人员签入项目的默认组,但这似乎是一种hack。什么好主意吗?谢谢。


当前回答

我遇到了同样的问题。阅读这里,我意识到这是文件权限的消息是指。对我来说,解决办法是:

/etc/inetd.d/git-gpv

它以“nobody”用户启动git-daemon,因此缺乏写权限。

# Who   When    What
# GPV   20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
# GPV   20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
#git stream tcp nowait nobody  /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
git stream tcp nowait user_git  /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo

(我怀疑其他人把他们的inetd conf文件称为git-gpv。通常它会直接在/etc/inetd.conf中)

其他回答

使用下面的命令,就像魔术一样

sudo chown -R "${USER:-$(id -un)}" .

准确地输入命令(在结尾有额外的空格和一个点)

命令分解

sudo

以root用户运行

chown

改变所有权

-R

针对所有文件和文件夹的递归操作

"${USER:-$(id -un)}"

从$ user中获取用户名,如果没有设置,则通过运行id -un获取值

.

定位当前目录

确保以admin身份打开命令行提示符。然后,确保项目文件不是只读的。

在windows中,您可以通过右键单击项目文件夹来检查->单击“显示更多选项”->单击“属性”->取消选择“只读”->单击“应用”

我遇到了同样的问题。阅读这里,我意识到这是文件权限的消息是指。对我来说,解决办法是:

/etc/inetd.d/git-gpv

它以“nobody”用户启动git-daemon,因此缺乏写权限。

# Who   When    What
# GPV   20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
# GPV   20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
#git stream tcp nowait nobody  /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
git stream tcp nowait user_git  /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo

(我怀疑其他人把他们的inetd conf文件称为git-gpv。通常它会直接在/etc/inetd.conf中)

我在使用Vagrant运行远程开发开发机器时得到了这个错误。上述解决方案都不能工作,因为所有文件都具有正确的权限。

我把config.vm.box = "hasicorp/ bioniic64 "改为config.vm.box = "bento/ubuntu-20.10"。

适用于Ubuntu(或任何Linux)

从项目根,

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

你可以通过以下方式说出你的名字和你所在的小组:

# for yourname
whoami
# for yourgroup
id -g -n <yourname>

注意:记住sudo行末尾的星号