git 먹통인 프로젝트 오류 해결 히스토리
commit하고 push한 기억이 없는데 이미 되어있던 프로젝트..
init 이라고 commit 되어있긴 한데 다시 처음부터 시작해보면서 뭐가 문제인지 해결해보자
$ git remote add origin url
해당 폴더에서 remote add부터 해주었다.
그런데 fatal: not a git repository (or any of the parent directories): .git 에러 뜸
이게 뭘까
현재 폴더에 git에 대한 정보를 담은 파일이 없어서 발생하는 에러이다.
$ git init
$ git remote add origin url
예ㅔㅔ 넘어갔다!
한 번 확인차
$ git remote -v
origin https://url.git (fetch)
origin https://url.git (push)
$ git status
이제 push를 위해서 commit안되는 파일들 다 add해주기
$ git add .
에러가 뜬다 드디어 원인 알게됨ㅜㅜ
intellij에서만 해결하려고 했어서 너무 답답했는데 일단 뭐라도 문제라고 떠준게 감사함 ~_~
warning: adding embedded git repository: frontend
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> frontend
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached frontend
hint:
hint: See "git help submodule" for more information.
찾아보니까 문제가 되는 폴더 안에 .git이 문제를 일으키는 것 같다
$ rm -rf .git
앞에 git을 붙이면 삭제안됨
ls -a로 다시 확인해보면 .git이 삭제된거 확인가능
이제 상위폴더(프로젝트)로 빠져나와서 add - commit - push 해준다.
$ cd ..
$ git add .
$ git status
On branch main
No commits yet
$ git commit -m "fixed commit error"
$ git push -u origin main
제대로 push 완료