.gitignore for Astro

4 ignore rules for Astro, ready to copy into your repository.

Content-driven web framework with islands architecture

The complete .gitignore for Astro

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 17:00:55 UTC
# Technologies: Astro

### Astro ###
# Distribution directory
dist/
# Astro generated types and content cache
.astro/
.env.production
# Environment variables
.env

What these Astro rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

Build output

Pattern What it ignores
dist/ Distribution directory

Generated types

Pattern What it ignores
.astro/ Astro generated types and content cache

Environment variables

Pattern What it ignores
.env.production Environment variables
.env Environment variables

How to use this .gitignore for Astro

  1. Copy the Astro rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other Framework .gitignore templates

See every Framework template