git warning, warning: adding embedded git repository

이도현·2023년 8월 12일
0

Error Collection

목록 보기
10/13
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> thesarang_front
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached thesarang_front
hint:
hint: See "git help submodule" for more information.

이 경고 메시지는 현재의 Git 저장소 내에 또 다른 Git 저장소 (embedded git repository)가 추가되었을 때 나타나는 것입니다. 이는 일반적으로 의도하지 않은 상황일 수 있으며, 이러한 중첩된 구조는 관리가 복잡해질 수 있기 때문에 경고가 표시되는 것입니다.

두 가지 일반적인 해결 방법

  • 서브모듈로 추가하려는 경우: 경고 메시지에서 제안하는 대로, git submodule add thesarang_front 명령을 사용하여 서브모듈로 추가할 수 있습니다. 서브모듈은 외부 저장소를 현재 저장소에 포함시키고 싶을 때 사용하는 기능입니다. 이렇게 하면 외부 저장소의 특정 버전을 현재 저장소와 함께 추적할 수 있게 됩니다.

  • 실수로 추가된 경우: 경고 메시지에서 제안하는 대로, git rm --cached thesarang_front 명령을 실행하여 인덱스에서 해당 경로를 제거할 수 있습니다. 이 명령은 해당 디렉토리를 추적하지 않도록 Git에 지시하는 것으로, 디렉토리 자체를 파일 시스템에서 제거하지는 않습니다.

어떤 상황인지에 따라 적절한 명령을 선택

  • 실수로 rm한 경우
    Untracked files:
    (use "git add ..." to include in what will be committed)
    thesarang_front/

git add thesarang_front/
이 명령어는 thesarang_front/ 디렉토리와 그 하위의 모든 파일을 스테이징 영역에 추가합니다. 이후 git commit 명령어를 사용하여 스테이징 영역의 변경 사항을 커밋할 수 있습니다.

git commit -m "Add thesarang_front directory"

이렇게 하면 thesarang_front/ 디렉토리와 그 하위의 모든 파일이 Git에 의해 추적되게 됩니다.

profile
좋은 지식 나누어요

0개의 댓글