더북(TheBook)

Terminal icon_terminal

> git status
On branch main
No commits yet
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        main.py
        pyproject.toml
        src/
nothing added to commit but untracked files present

Untracked files: 목록에 .env 파일이 보이지 않으면 정상입니다.

git status 결과에 .env 파일이 표시된다면 .gitignore가 적용되지 않은 것입니다. 이 경우 .gitignore 파일을 열어 .env가 올바르게 등록되어 있는지 확인합니다. .gitignore를 수정한 뒤 다시 git status를 실행해 .env 파일이 목록에서 사라졌는지 확인합니다.

만약 .env 파일이 이미 Git에 한 번이라도 커밋된 적이 있다면 .gitignore에 추가해도 Git은 계속 해당 파일을 추적합니다. 따라서 다음 명령어를 실행해 .env 파일을 Git의 추적 대상에서 제거해야 합니다.