
다른 곳에서 작업하던 파일을 깃헙 저장소가 연결된 폴더로 옮겨 push 후, 레파지토리에 들어가 확인해보니 폴더 클릭이 안 되는 현상이 발생했다. 폴더도 일반 폴더 아이콘이 아닌 흰색 화살표가 그려져 있는 모습이었다.

문제 원인
push한 폴더에 이미 다른 git 저장소가 존재해 git이 중첩되면서 발생한 오류였다. 해당 폴더 경로로 이동해 아래 명령어로 확인해보자. (참고로 .git 폴더는 숨겨져 있어 ls 뒤에 옵션 -a를 붙여야 한다.)
$ ls -a

확인해보니 역시나 .git
이 존재하고 있었다. CRA는 .git 폴더를 자체 생성해주는데 이를 잠깐 잊고 있었다..
해결 과정
.git 삭제
먼저 해당 폴더의 .git
을 삭제한다.
$ rm -rf .git

.git 폴더를 삭제한다고 바로 푸시할 수 있는 것은 아니다. 원격 저장소에 존재하는 문제의 폴더(화살표 폴더)도 제거해주어야 한다.
원격 저장소 폴더 삭제
원격 저장소에 클릭 되지 않는 문제의 폴더 또는 파일을 아래 명령어로 삭제한다.
$ git rm --cached {해당 폴더}
그리고 다시 add - commit - push 과정을 거치면 원격 저장소에 문제의 폴더는 제거되고 정상적으로 기존의 폴더가 올라간 것을 확인할 수 있다.
$ git add .
$ git commit -m "{commit message}"
$ git push origin main

References
Table Of Contents