From a629bd516ce7cb62d5b600ea89dea70fd59753b3 Mon Sep 17 00:00:00 2001 From: wangwei Date: Tue, 23 Jun 2026 11:22:24 +0800 Subject: [PATCH] chore: add .gitattributes to enforce LF for shell scripts and Python files Prevents CRLF line endings on .sh files which cause '/usr/bin/env: bash\r' errors when running on Linux. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitattributes | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3217eb9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +# 默认:文本文件使用 LF(Linux/macOS 风格) +* text=auto eol=lf + +# Shell 脚本强制 LF,无论在哪个平台 checkout +*.sh text eol=lf + +# Python 和 YAML 也用 LF +*.py text eol=lf +*.yaml text eol=lf +*.yml text eol=lf +*.md text eol=lf +*.json text eol=lf +*.toml text eol=lf +*.txt text eol=lf +*.env text eol=lf +*.env.example text eol=lf + +# Windows 脚本保留 CRLF +*.ps1 text eol=crlf +*.bat text eol=crlf + +# 二进制文件不转换 +*.pdf binary +*.png binary +*.jpg binary +*.csv binary