From 21de32a568ee2fa0ed54b30b92a5e156043ee79f Mon Sep 17 00:00:00 2001 From: king Date: Thu, 21 May 2026 23:45:41 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20push-gitea.bat=EC=97=90=20=EB=AF=BC?= =?UTF-8?q?=EA=B0=90=20=ED=8C=8C=EC=9D=BC=20=EC=82=AC=EC=A0=84=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 푸시 전 git에 추적 중인 민감 파일(.env, *.pem, *.key, *secret*, *password*, *credential*, *token* 등)을 자동 검사하여 발견 시 푸시를 차단하고 제거 방법을 안내함 Co-Authored-By: Claude Sonnet 4.5 --- push-gitea.bat | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 push-gitea.bat diff --git a/push-gitea.bat b/push-gitea.bat new file mode 100644 index 0000000..5c0ea0e --- /dev/null +++ b/push-gitea.bat @@ -0,0 +1,72 @@ +@echo off +cd /d "%~dp0" + +echo. +echo [1/2] Checking for sensitive files... +echo. + +set FOUND=0 + +:: git? ??? ??(tracked)?? ?? ?? ?? +for %%F in ( + .env + .env.local + .env.production + .env.secret +) do ( + git ls-files --error-unmatch "%%F" >nul 2>&1 + if not errorlevel 1 ( + echo [ERROR] Sensitive file is tracked by git: %%F + set FOUND=1 + ) +) + +:: ??? ?? ?? ??? git? ????? ?? +for %%P in ( + *.pem *.key *.p12 *.pfx id_rsa id_ed25519 + *secret* *password* *credential* *token* *apikey* *api_key* + db.conf database.conf +) do ( + git ls-files "%%P" 2>nul | findstr /r "." >nul 2>&1 + if not errorlevel 1 ( + echo [ERROR] Sensitive file pattern tracked by git: %%P + set FOUND=1 + ) +) + +if %FOUND%==1 ( + echo. + echo ============================================================ + echo PUSH BLOCKED: Sensitive file found in git. + echo. + echo Remove it with: + echo git rm --cached ^ + echo git commit -m "remove sensitive file" + echo. + echo Then add it to .gitignore to prevent future accidents. + echo ============================================================ + echo. + pause + exit /b 1 +) + +echo No sensitive files detected. Safe to push. +echo. + +echo [2/2] Pushing to Gitea... +echo https://gitea.no1king.freeddns.org/king/dbx-main.git +echo. + +git push -u origin master + +if %errorlevel%==0 ( + echo. + echo [OK] Push complete. + echo https://gitea.no1king.freeddns.org/king/dbx-main + echo. +) else ( + echo. + echo [ERROR] Push failed. Check your credentials or network. + echo. +) +pause \ No newline at end of file