Write tool uses OS-default line endings instead of respecting .gitattributes

Resolved 💬 3 comments Opened Mar 15, 2026 by corby Closed Mar 19, 2026

Description

On Windows, the Write tool always emits CRLF line endings regardless of the repository's .gitattributes configuration. This causes git warnings on every file written:

warning: in the working copy of 'path/to/file.py', CRLF will be replaced by LF the next time Git touches it

Reproduction

  1. On Windows, configure git for LF-only:

``
git config --global core.autocrlf input
git config --global core.eol lf
``

  1. Have a .gitattributes with * text=auto eol=lf
  2. Use the Write tool to create or overwrite any text file
  3. Run git add on the file

Expected behavior

The Write tool should respect .gitattributes (or at minimum core.eol) and write LF line endings when the repo is configured for it.

Actual behavior

The Write tool uses CRLF (Windows default) regardless of git configuration. Git then normalizes to LF on commit, producing a warning for every file touched.

Impact

  • Noisy warnings on every git add / git commit
  • Misleading diff noise if files are inspected before commit
  • No data loss (git normalizes correctly), but the UX is poor

Environment

  • Platform: Windows 11
  • Shell: bash (Git Bash)
  • Claude Code model: claude-opus-4-6

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗