Git Permission issues: insufficient permission for adding an object to repository database .git

Error in Git pull: invalid permission for adding an object to repository database. Git

(go to the object folder in the warehouse and execute Chmod 777 – R *)

Git made a mistake in pull. The situation is as follows:

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

According to the error prompt, it is found that there is a problem with the ownership of some files under “. Git/objects”:

[[email protected] my]$ git pull [email protected]: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

Log in as root and enter the directory:

[[email protected] objects]# ll | grep root  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 3b  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 68  
[[email protected] objects]# chown lixinglei: 3b  
[[email protected] objects]# ll | grep root  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 68  
[[email protected] objects]# chown lixinglei: 68  
[[email protected] objects]# cd 68  
[[email protected] 68]# ll  
Totally 4  
-r--r--r--. 1 root root 213 May  27 19:37 cb6ab3332e342158b1b27341a2c396cd570a4c  
[[email protected] 68]# chown lixinglei: cb6ab3332e342158b1b27341a2c396cd570a4c  
[[email protected] 68]# cd ../  
[[email protected] objects]# cd 3b  
[[email protected] 3b]# ll  
Totally 4  
-r--r--r--. 1 root root 1647 May  27 19:37 d60abd850ecacb4002ed870176172426f662d2  
[[email protected] 3b]# chown lixinglei: d60abd850ecacb4002ed870176172426f662d2  

Similar Posts: