Git에서 git pull
을 실행할 때 다음과 같은 오류가 발생할 수 있습니다.
Pulling 1 repository
Cannot pull into a repository with state: MERGING_RESOLVED
Cannot pull into a repository with state: MERGING_RESOLVED
이 오류는 Git이 병합(Merge) 과정에서 MERGING_RESOLVED 상태로 남아있어 git pull
을 실행할 수 없는 경우 발생합니다.
즉, 병합 충돌이 해결된 상태지만 아직 커밋(commit)이 완료되지 않은 상태입니다.
해결 방법 1: 병합 완료하기 (git commit
)
- 현재 병합 상태를 확인합니다. sh복사편집
git status
- 만약 “All conflicts fixed but you are still merging” 메시지가 나오면 병합이 해결된 상태입니다.
- 아래 명령어를 실행하여 병합을 완료합니다. sh복사편집
git commit
- 이후
git pull
을 다시 실행하면 정상적으로 작동할 것입니다.
해결 방법 2: 병합 취소하기 (git merge --abort
)
병합을 진행하고 싶지 않다면, 다음 명령어를 실행하세요.
git merge --abort
이후 다시 git pull
을 실행하면 됩니다.
추가 오류: fatal: detected dubious ownership in repository
발생 시 해결 방법
git status
를 실행했을 때 다음과 같은 오류가 발생할 수도 있습니다.
fatal: detected dubious ownership in repository at 'C:/경로/프로젝트'
'C:/경로/프로젝트' is owned by:
BUILTIN/Administrators (S-1-5-32-544)
but the current user is:
사용자이름/사용자이름 (S-1-5-21-xxxx)
To add an exception for this directory, call:
git config --global --add safe.directory C:/경로/프로젝트
이 문제는 Git이 저장소의 소유자와 현재 사용자가 다르다고 판단했을 때 발생합니다.
이를 해결하려면 아래 명령어를 실행하세요.
git config --global --add safe.directory C:/경로/프로젝트
위 명령어를 실행한 후 다시 git merge --abort
또는 git pull
을 실행하면 정상적으로 작동할 것입니다.
결론
git pull
실행 중 “Cannot pull into a repository with state: MERGING_RESOLVED” 오류가 발생하면,- 병합이 완료되지 않은 경우 →
git commit
실행 - 병합을 취소하려면 →
git merge --abort
실행
- 병합이 완료되지 않은 경우 →
git status
실행 시 “detected dubious ownership in repository” 오류가 발생하면,git config --global --add safe.directory [경로]
실행 후 다시 시도
이 과정을 따르면 Git 오류를 해결하고 정상적으로 git pull
을 실행할 수 있습니다.