From 8def6e0553bc93bfe85d9a7f639d8c7b8acd9382 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 22 Nov 2026 02:20:14 +0900 Subject: [PATCH] =?UTF-8?q?fix(gitignore):=20=ED=95=98=EC=9C=84=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=EC=9D=98=20=EC=8B=A4=EC=A0=9C=20.env=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=8F=84=20git=EC=9D=B4=20=EB=AC=B4=EC=8B=9C?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: .gitignore의 `/.env*`는 저장소 루트의 .env만 무시한다. 재배치 커밋 1388c06a가 `src/.env*`와 예시 예외 둘을 지우고 루트 줄로 바꿨다. 그래서 src/.env, src/.env.local, 아무 하위 폴더의 .env.lane이 무시되지 않고, `git add -A` 한 번이면 실제 환경 파일이 이력에 들어간다. scripts/verify.sh는 미추적 파일로 rc=5를 내지만 사람의 커밋은 막지 못한다. 파생 서비스도 같은 .gitignore를 물려받는다. 고른 방법: `**/.env*`로 어느 폴더든 .env로 시작하는 파일을 무시하고, 추적 중인 예시 둘만 `!**/.env.example`, `!**/.env.local.example`로 되살린다. 따로 있던 `/.env.lane` 줄은 이 줄에 들어가서 지웠다. 버린 대안: - 이름 나열(`**/.env`, `**/.env.local`, `**/.env.lane`): C2 경로는 모두 막지만 .env.prod·.env.staging 같은 프로필 파일을 놓친다. 루트에서는 지금 `/.env*`가 막던 .env.<프로필>이 다시 열린다. - `src/.env*`만 되살리기: 재배치 뒤 다른 하위 폴더(compose-lanes 등)에 생기는 파일을 또 놓친다. - `!**/.env*.example`로 예시를 넓게 되살리기: 지금 추적하는 예시는 둘뿐이다. 넓히면 .env.<무엇>.example 이름의 실제 파일도 열린다. 새 예시는 `!` 줄을 하나 더하면 된다. 위험·한계: 새 예시 파일(예: .env.lane.example)을 더하면 `!` 줄 없이는 git이 무시한다. 막히는 쪽으로 실패하고, `git add`가 무시된 파일이라고 알린다. 이미 추적 중인 파일은 .gitignore가 빼지 않는다. 이 repo의 추적 목록에는 해당 파일이 없다(`git ls-files -ci --exclude-standard` 빈 결과). 스테이지된 .env 꼴 파일을 막는 pre-commit이나 CI 검사는 없고, 이 커밋도 만들지 않는다. 검증: 실제 .env는 열지 않고, 없는 경로에 `git check-ignore -q --no-index <경로>`를 돌려 rc를 봤다. - C1: 고치기 전(b2bfb9bb·484264cb, .gitignore blob ae53be55) src/.env rc=1. 고친 뒤 rc=0(`**/.env*`). - C2: .env, .env.local, .env.lane, src/.env, src/.env.local, src/.env.lane, sub-x/.env, sub-x/.env.local, sub-x/.env.lane, build-x/.env.lane, src/bootstrap/app/compose-lanes/.env, deep/a/b/.env.staging, sub-x/.env.prod 모두 rc=0. .env.example, .env.local.example, 같은 이름의 src/·sub-x/ 예시는 모두 rc=1. - C3: `git ls-files '*.env*'` 전후 모두 .env.example, .env.local.example. `git ls-files -ci --exclude-standard` 전후 빈 결과. Refs: REV-BE-0048 Fixes: 1388c06a9f18 ("refactor(layout)!: Gradle 루트와 계층 폴더를 옮긴다(옮기기만)") --- .gitignore | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index ae53be55..e05d587e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,14 +28,14 @@ src/**/src/*/java/**/*.received.* !.claude/agents/ !.claude/skills/ -# Operator input, not a build input. The examples beside it are the tracked contract; -# verifyEnvKeys reads the registry, the profile YAMLs and .env.example, never a real one. -/.env* -!/.env.example -!/.env.local.example - -# Written per run by the runtime-smoke wrapper; never committed. -/.env.lane +# Operator input, not a build input: a real environment file stays out in any folder, not only at +# the root. That covers .env, .env.local, a src/.env left over from before the relayout, the +# .env.lane the runtime-smoke wrapper writes per run, and any .env.. Only the two examples +# are tracked; they are the contract, and verifyEnvKeys reads the registry, the profile YAMLs and +# .env.example, never a real one. A new example needs its own ! line, or Git ignores it. +**/.env* +!**/.env.example +!**/.env.local.example # bootRun's file log when APP_LOG_FILE_ENABLED=true: APP_LOG_FILE_PATH is relative to the repository root. /logs/ -- 2.54.0