简体   繁体   English

无法以普通用户身份推送到git存储库

[英]Can't push to git repository as normal user

There are a couple good posts on this subject, but I am not sure if they apply to my circumstances. 关于这个问题有好几篇文章,但是我不确定它们是否适用于我的情况。

Error pushing to GitHub - insufficient permission for adding an object to repository database 推送至GitHub时出错-权限不足,无法将对象添加到存储库数据库

Git Push Error: insufficient permission for adding an object to repository database Git Push错误:没有足够的权限向存储库数据库添加对象

When performing a push as a normal user, I receive the following error: 以普通用户身份执行推送时,出现以下错误:

remote: error: insufficient permission for adding an object to
    repository database ./objects

Note that I can push if I am logged on the local machine as root. 请注意,如果我以root用户身份登录本地计算机,则可以推送。 I see from the below that the origin is git@easybbb.com:root I don't know if it matters, but the remote repository I am trying to push to is hosted by me using GitLab. 我从下面看到,来源是git@easybbb.com:root我不知道这是否重要,但是我尝试推送到的远程存储库由我使用GitLab托管。

The local git directory is 0775 and belongs to group "www", I've executed chmod -R g+rwxs /var/www/ to ensure that new files are of group "www", the normal user that is trying to push belongs to group "www", and I've executed git config core.sharedRepository group . 本地git目录为0775,属于“ www”组,我已执行chmod -R g+rwxs /var/www/以确保新文件属于“ www”组,正试图推送的普通用户属于分组为“ www”,并且我执行了git config core.sharedRepository group

How do I fix this error? 如何解决此错误?

git push origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 487 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To git@easybbb.com:root/bidjunction.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'git@easybbb.com:root/bidjunction.git'

git remote -v
origin  git@easybbb.com:root/bidjunction.git (fetch)
origin  git@easybbb.com:root/bidjunction.git (push)

It has nothing to do regarding the many similar questions. 它与许多类似的问题无关。 The key is "remote: error: ". 关键是“远程:错误:”。 The problem is the remote repository (GitLab which is similar to GitHub). 问题是远程存储库(类似于GitHub的GitLab)。 Making all associated files owned by git solved the problem. 使所有关联文件归git所有即可解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM