Skip to content

Pin shell scripts to LF endings via .gitattributes#6

Merged
grloper merged 1 commit into
mainfrom
claude/demo-script-line-endings-5m2r6i
Jul 17, 2026
Merged

Pin shell scripts to LF endings via .gitattributes#6
grloper merged 1 commit into
mainfrom
claude/demo-script-line-endings-5m2r6i

Conversation

@grloper

@grloper grloper commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Problem

Running ./demo.sh on a Windows checkout fails with:

/usr/bin/env: 'bash\r': No such file or directory

The repo stores demo.sh with LF endings, but with no .gitattributes present, Git for Windows' core.autocrlf rewrites the shebang to #!/usr/bin/env bash\r\n on checkout. The kernel then tries to resolve an interpreter literally named bash\r and fails. Everything else (cargo clippy, tests, --ui, scan) is unaffected because only the shell script's shebang is sensitive to the trailing \r.

Fix

Add a .gitattributes that pins shell scripts to LF on every platform, regardless of the checkout's core.autocrlf setting:

* text=auto
*.sh text eol=lf

Ran git add --renormalize . — no file content changed since the repo was already LF. bash -n demo.sh passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_016ATUW6fbK4Spc3fJKL6se1


Generated by Claude Code

demo.sh's `#!/usr/bin/env bash` shebang breaks on Windows checkouts where
autocrlf rewrites it to CRLF, producing `/usr/bin/env: 'bash\r': No such
file or directory`. Add a .gitattributes that forces LF for *.sh on every
platform so the script stays runnable regardless of the checkout's
core.autocrlf setting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ATUW6fbK4Spc3fJKL6se1
@grloper
grloper merged commit 805e5fa into main Jul 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants