나의 에러 일지

Git - error: insufficient permission for adding an object to repository database .git/objects 원인과 해결 방법

Cold Bean 2023. 11. 14. 21:09
728x90

개요

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

 

Git을 이용하다가 만난 문제. Git Pull을 하는 과정에서 발생했다.

 

원인

이 에러는 .git/object의 파일 읽기, 쓰기 권한이 없을 때 발생한다.

확인해보니 root사용자로 git pull을 한적이 있어서 몇몇개의 파일 사용자가 root으로 되어 있었다.

# ls -al

drwxr-xr-x.  2 root root   52 11월  9 15:02 89   <- 이 노옴이 문제다
drwxrwxr-x.  2 user  user    52 11월  9 14:23 92
drwxrwxr-x.  2 user  user    52 11월  9 14:23 95

 

 

해결

파일 사용자를 원래의 user로 변경해줬다. 이후 문제없이 Git Pull을 땡겨올 수 있었다

# chown -R user:user ./objects
# ls -al

drwxr-xr-x.  2 user user   52 11월  9 15:02 89
drwxrwxr-x.  2 user  user    52 11월  9 14:23 92
drwxrwxr-x.  2 user  user    52 11월  9 14:23 95

 

참조

 

Git Push Error: insufficient permission for adding an object to repository database

When I try to push to a shared git remote, I get the following error: insufficient permission for adding an object to repository database Then I read about a fix here: Fix This worked for the nex...

stackoverflow.com

 

728x90