.gitignore for Kotlin

14 ignore rules for Kotlin, ready to copy into your repository.

Modern programming language for JVM and Android

The complete .gitignore for Kotlin

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2025-08-01 13:23:05 UTC
# Technologies: Kotlin

### Kotlin ###
# Java compiled class file
*.class
# Java archive
*.jar
# Log file
*.log
*.ctxt
# Web application archive
*.war
.mtj.tmp/
# Native archive
*.nar
# Enterprise archive
*.ear
# ZIP archive
*.zip
# Gzipped tar archive
*.tar.gz
# RAR archive
*.rar
# Java crash log
hs_err_pid*
# Java replay file
replay_pid*
.kotlin/

What these Kotlin rules actually ignore

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

Compiled class file

Pattern What it ignores
*.class Java compiled class file

Package Files #

Pattern What it ignores
*.jar Java archive
*.war Web application archive
*.nar Native archive
*.ear Enterprise archive
*.zip ZIP archive
*.tar.gz Gzipped tar archive
*.rar RAR archive
hs_err_pid* Java crash log
replay_pid* Java replay file

Log file

Pattern What it ignores
*.log Log file

BlueJ files

Pattern What it ignores
*.ctxt BlueJ files

Mobile Tools for Java (J2ME)

Pattern What it ignores
.mtj.tmp/ Mobile Tools for Java (J2ME)

Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-

Pattern What it ignores
.kotlin/ Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-

How to use this .gitignore for Kotlin

  1. Copy the Kotlin 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 Language .gitignore templates

See every Language template