Skip to content
Latchkey

What Is a .gitattributes file?

a .gitattributes file explained, including what it does and how it matters in CI/CD.

A .gitattributes file tells Git how to handle specific paths: line endings, diff/merge behavior, and LFS tracking.

What it is

Setting * text=auto and explicit eol rules normalizes line endings so the same content checks out consistently across operating systems.

Why it matters in CI/CD

In CI, this prevents CRLF-related failures (shell scripts with \r) on Linux runners and controls which files use Git LFS.

Key takeaways

  • .gitattributes controls per-path Git behavior.
  • It normalizes line endings.
  • Prevents CRLF failures in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →