[intellij git]detected dubious ownership in repository 오류 해결 방법

컴퓨터를 재설치하고 intelliJ에서 git 설정을 해보던 중 detected dubious ownership in repository 오류가 발생했다.

 

원인

이 오류는 복제나 푸시와 같은 저장소에서 git 명령을 실행할때 저장소의 소유권이 의심스럽다는 오류를 반환하는 것이다.

 

해결 방법

저장소 폴더의 소유자를 git 명령을 실행하는 사용자로 변경해야 한다.

git config --global --add safe.directory [해당 repository 폴더]

 

git 2.36 상위버전을 사용한다면 모든 폴더를 safe.directory 목록에 추가하는 와일드카드를 사용할 수도 있다.

git config --global --add safe.directory '*' 
git config --system --add safe.directory '*'