Tip

[Tip | Git] detected dubious ownership in repository

t-opendocs 2025. 1. 22. 16:46
반응형

GitHub으로 부터 pull 수행시 에러에 대해 정리한다.


> 작성일 : 2025-01-22
> git : version 2.34.1

 

<1> 문제상황

GitHub으로 부터 pull 명령 수행시 아래와 같이 에러가 발생

fatal: detected dubious ownership in repository at '/docker/mungpl-docs'
To add an exception for this directory, call:

        git config --global --add safe.directory /docker/mungpl-docs

 


 

<2> 문제확인

에러 내용으로 보아 해당 폴더를 예외로 추가해 주면 해결 될것으로 보인다.

To add an exception for this directory

단순히 명령을 수행하기 보다 'owership' 권한 정보를 확인해 처리해보자.

 


 

<3> 문제해결

<3-1> 해당 폴더의 소유권을 확인한다.
ls -l

 

다른 계정에 소유권으로 확인된다. 폴더의 소유권을 바꾼다.

sudo chown -R {현재계정}:{현재계정} /path/to/repository
<3-2> 예외로 등록한다.
git config --global --add safe.directory {프로젝트 폴더}



반응형