当前位置:Gxlcms > 数据库问题 > git push到远程仓库时出现Git Push Error: insufficient permission for adding an object to repository database

git push到远程仓库时出现Git Push Error: insufficient permission for adding an object to repository database

时间:2021-07-01 10:21:17 帮助过:12人阅读

原因

其中一个原因是git远程仓库的目录的拥有者不在同一个group里,使得其他用户在另一个用户的子目录中不能添加文件,因为两者不在同一个组里面,然后前者就相当于这个子目录的“其他用户”,而不是“同组用户”,然后“其他用户”又没有写的权限,所以就出现了这个问题(“拥有者”,“同组用户“,”其他用户”权限可通过ls -l命令查看,参考链接)。

解决方案

ssh to yourServer

#进入git仓库目录
cd repository.git

#为同组用户添加写权限,并且今后仓库中的创建的子目录、子文件的所属组都继承父目录
#-R表示递归处理,g+ws中的s代表setgid,即新建的文件或目录继承父目录的所属组
# * 即通配符,代表当前文件夹的所有文件和目录(除了隐藏文件和目录, ls -al -R好像没看到远程仓库有隐藏文件)
sudo chmod -R g+ws *
#更换成适当的用户组
sudo chgrp -R myGroupName *

git config core.sharedRepository true

参考链接:

  • https://codeday.me/bug/20170516/16383.html
  • https://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab

git push到远程仓库时出现Git Push Error: insufficient permission for adding an object to repository database

标签:处理   一个   不能   通配   config   仓库   mis   database   解决方案   

人气教程排行