.gitignoreとは

Gitの管理対象から除外するファイルやフォルダを指定するファイル。

Astroプロジェクト向け設定

node_modules/
dist/
.env
.env.local
.astro/
*.log
.DS_Store

.gitignoreが効かない時の対処法

git rm -r --cached ファイル名
git add .
git commit -m "remove from tracking"

テンプレートを使う

https://www.toptal.com/developers/gitignore で自動生成できる。

ハマったポイント

  • .env ファイルには絶対に秘密のキーを書かない
  • すでにcommitしたファイルは git rm --cached で外す

関連記事