zoukankan      html  css  js  c++  java
  • git 权限问题:insufficient permission for adding an object to repository database .git

    在git pull 的时候报错:insufficient permission for adding an object to repository database .git

     (去仓库里的object文件夹下 执行 chmod 777 -R *)

    Git在pull时报错,发生情况如下:

    [lixinglei@bogon my]$ ll -a|grep .git  
    drwxrwxr-x.  8 lixinglei lixinglei 4096 6月   6 19:58 .git  
    -rw-rw-r--.  1 lixinglei lixinglei  109 4月  23 14:02 .gitignore  
    [lixinglei@bogon my]$ cd .git  
    [lixinglei@bogon .git]$ cd objects/  
    [lixinglei@bogon objects]$ ll | grep root  
    drwxr-xr-x. 2 root      root      4096 5月  27 19:37 3b  
    drwxr-xr-x. 2 root      root      4096 5月  27 19:37 68  

    根据报错提示,发现是".git/objects"下有些文件的归属有问题:

    [lixinglei@bogon my]$ git pull git@XXX.XXX.XXX.XXX:XXX.git  
    remote: Counting objects: 29, done.  
    remote: Compressing objects: 100% (22/22), done.  
    remote: Total 22 (delta 17), reused 0 (delta 0)  
    error: insufficient permission for adding an object to repository database .git/objects  
      
    fatal: failed to write object  
    fatal: unpack-objects failed  

    使用root登录并进入该目录:

    [root@bogon objects]# ll | grep root  
    drwxr-xr-x. 2 root      root      4096 5月  27 19:37 3b  
    drwxr-xr-x. 2 root      root      4096 5月  27 19:37 68  
    [root@bogon objects]# chown lixinglei: 3b  
    [root@bogon objects]# ll | grep root  
    drwxr-xr-x. 2 root      root      4096 5月  27 19:37 68  
    [root@bogon objects]# chown lixinglei: 68  
    [root@bogon objects]# cd 68  
    [root@bogon 68]# ll  
    总用量 4  
    -r--r--r--. 1 root root 213 5月  27 19:37 cb6ab3332e342158b1b27341a2c396cd570a4c  
    [root@bogon 68]# chown lixinglei: cb6ab3332e342158b1b27341a2c396cd570a4c  
    [root@bogon 68]# cd ../  
    [root@bogon objects]# cd 3b  
    [root@bogon 3b]# ll  
    总用量 4  
    -r--r--r--. 1 root root 1647 5月  27 19:37 d60abd850ecacb4002ed870176172426f662d2  
    [root@bogon 3b]# chown lixinglei: d60abd850ecacb4002ed870176172426f662d2  
     

     

  • 相关阅读:
    mybatis 批量插入时候的一个注意点
    centos7 kubernetes单机安装
    debug 模式缓慢
    那些年,我们误解的 JavaScript 闭包
    maven仓库的配置
    闭包
    docker 搭建自己的github
    docker 搭建小型的node开发环境。
    jquery validate
    使用ueditor中的setContent() 时经常报innerHtml错误(笔记)
  • 原文地址:https://www.cnblogs.com/haiyan123/p/9237826.html
Copyright © 2011-2022 走看看