Git:将对象添加到存储库数据库的权限不足
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12770410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git: insufficient permission for adding an object to repository database
提问by rodnower
I have git error: "insufficient permission for adding an object to repository database" every time I make "git push origin master".
I tried solution described here: http://parizek.com/2011/05/git-insufficient-permission-for-adding-an-object-to-repository-database-objects/but it works only until next time...
Is there some permanent solution?
每次我制作“git push origin master”时,我都会遇到git错误:“将对象添加到存储库数据库的权限不足”。
我尝试了这里描述的解决方案:http: //parizek.com/2011/05/git-insufficient-permission-for-adding-an-object-to-repository-database-objects/但它只能工作到下一次......
有什么永久的解决方案吗?
$ git push origin master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.19 KiB, done.
Total 3 (delta 2), reused 0 (delta 0)
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://[email protected]/p/project/code
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://[email protected]/p/project/code'
$ git config core.sharedRepository true
$ git push origin master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.19 KiB, done.
Total 3 (delta 2), reused 0 (delta 0)
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://[email protected]/p/project/code
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://[email protected]/p/project/code'
$ sudo chmod -R g+ws *
$ sudo chgrp -R andrey *
$ git push origin master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.19 KiB, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: <Repository /git/p/project/code.git> refresh queued.
To ssh://[email protected]/p/project/code
acd82d2..f401c90 master -> master
This is Ubuntu I use: 12.04.1, and git: 1.7.9.5
这是我使用的 Ubuntu:12.04.1,和 git:1.7.9.5
采纳答案by VonC
As mentioned in "Error pushing to GitHub - insufficient permission for adding an object to repository database", you need, in addition of the git config setting, to:
如“错误推送到 GitHub - 将对象添加到存储库数据库的权限不足”中所述,除了 git 配置设置之外,您还需要:
- first set the
umask
for all your repos:umask 002
(so on your server side) - then set the git group to
rw
as mentioned in your solution, still on the server side.
- 首先
umask
为您的所有存储库设置 :(umask 002
所以在您的服务器端) - 然后将 git 组设置
rw
为您的解决方案中提到的,仍然在服务器端。
回答by Zsolt Szilagyi
That usually happens when someone commited to git while booing root. The .git/* files created in that process are protected from external change.
当有人在嘘 root 的同时承诺使用 git 时,通常会发生这种情况。在该过程中创建的 .git/* 文件不受外部更改的影响。
chmod -R 777 .git
is a fast fix.
是一个快速修复。