한줄요약 : 프로젝트 생성 시 깃 레포지토리 초기화를 스킵하는 옵션을 주고 생성하면 된다.
nest new --skip-git <프로젝트명>
github 레포지토리를 생성하고 Nest-cli를 통해 Nest 프로젝트를 생성했다.
아래 명령어로 생성
nest new <project-name>
프로젝트가 생성되며 node-modules 를 install 하는 단계에서
git으로 잘 추적되던 프로젝트 폴더가 갑자기 통째로 추적을 멈춰버리는 문제가 있었다.
untracked files에 해당 폴더가 있길래
강제로 git이 추적하도록 하기 위해
git add --force
명령어를 사용해보았지만 아무런 변화가 없고, 여전히 폴더 째로 untracked된 상태였다.
깃헙에서 레포지토리를 생성할 때 깃헙에서 제공하는 템플릿으로 생성된 .gitignore가 문제인가 싶어
전체 주석도 해보고 파일 자체를 삭제도 해보았지만
동일한 문제가 나타났다.
구글링을 통해 찾아보니 동일한 문제 때문에 올라온 스택오버플로의 글이 있었고,
그 중 한 답변을 통해 해답을 찾았다.
https://stackoverflow.com/questions/76655969/nest-js-commit-problems-to-github
Nest js commit problems to github
Created a Nest.js project with using nest new and when I went to commit it on github using github desktop it says that the file is empty when its clearly not. Tried using git add . and it says (htt...
stackoverflow.com
프로젝트를 생성할 때 git repository initialization 을 통해 프로젝트 폴더 내부에 깃 파일과 .gitignore가 생성되는 등 깃 관련 초기화 작업을 해주는데, 이때 문제가 생기는 것으로 보여졌다.
따라서 이 작업을 스킵하도록 하는 옵션을 넣어 프로젝트를 생성하면 해결 되었다.
nest new --skip-git <프로젝트명>
공식문서에 해당 부분
https://docs.nestjs.com/cli/usages
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Rea
docs.nestjs.com
이때 정확히 어떤 과정을 거치게 되는지는 공식 문서에서 확인이 어렵지만
nest 프로젝트 생성 시 내부에도 .git 파일과 .gitignore 파일이 생성되는데 그게 문제되는게 아닐까 싶다.
댓글 피드백은 언제나 환영합니다!

'BackEnd > Trouble shooting' 카테고리의 다른 글
TypeORM Repository 조건(옵션) 안될 때 (2) | 2024.09.10 |
---|