# 统一换行符:仓库内与工作区一律 LF # # 为什么必须显式声明(而不是依赖各人的 core.autocrlf): # 1. 部署目标是 Linux。think 脚本首行是 #!/usr/bin/env php, # 一旦混入 CRLF,Linux 会报 # /usr/bin/env: 'php\r': No such file or directory # 这种错看起来像"PHP 没装",实际是换行符问题,排查很费时间。 # 2. Windows 开发机默认 core.autocrlf=true,行为因人而异; # 写进仓库才不依赖每个人的本地设置。 * text=auto eol=lf # 明确哪些是文本(避免被当成二进制跳过换行归一) *.php text eol=lf *.json text eol=lf *.md text eol=lf *.xml text eol=lf *.yml text eol=lf *.yaml text eol=lf *.txt text eol=lf *.env* text eol=lf *.ini text eol=lf *.conf text eol=lf *.htaccess text eol=lf .gitignore text eol=lf .gitattributes text eol=lf think text eol=lf # 二进制文件:不做换行处理 *.png binary *.jpg binary *.jpeg binary *.gif binary *.ico binary *.webp binary *.zip binary *.phar binary