나중에 내가 보려고 만든 블로그

Git fatal: detected dubious ownership in repository at 에러 해결 본문

etc.

Git fatal: detected dubious ownership in repository at 에러 해결

winches 2025. 2. 3. 20:45

어제까지 잘되던 깃허브 커밋이 갑자기 이런 에러가 발생했다.

일단 fatal로 시작해서 좀 무서웠지만 읽어보니 아래에 나온 커맨드를 실행해주면 됨.

fatal: detected dubious ownership in repository at '<path to the repository>'
To add an exception for this directory, call:
git config --global --add safe.directory <path to the repository>

 

찾아보니 prevent a user from executing git commands in a repository owned by a different user. 때문에 생겨난 보안정책이라고 한다. 내가 기관에서 제공해주는 가상환경에서 웹페이지 개발하고 있어서 이런 오류가 생긴듯하다. 근데 여태껏 없다가 한달만에 처음 나타난 오류...ㅎ....

 

워크스페이스 경로를 <>에 넣고 아래 명령어를 실행해주면 된다.

 

git config --global --add safe.directory <path to the repository>

 

그리고 나는 또 다시 같은 에러가 나길래 VS code랑 커맨드창 다 끄고 다시 실행해서

git add * 했더니 정상적으로 커밋되었음.

 

세상엔 배울 것이 너무나 많고 에러는 더 많다.

 

참고 : https://confluence.atlassian.com/bbkb/git-command-returns-fatal-error-about-the-repository-being-owned-by-someone-else-1167744132.html