关于git提交代码时的LF、CRLF提示的问题

代码提交的时候可能会遇到以下的提示,提示文本中的末尾换行符会进行自动替换,这个是由于windows和linux系统差异导致的,如果想妥善处理这个问题的话,需要修改git配置,可以参照以下配置

shell 复制代码
17303@ZMsnow MINGW64 /j/githome/yunlanzhiyue (master)
$ commit
warning: in the working copy of '.idea/misc.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.idea/yunlanzhiyue.iml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'manage.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'settings/settings.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'yunlanzhiyue-mini/project.config.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'yunlanzhiyue-mini/project.private.config.json', LF will be replaced by CRLF the next time Git touches it
Please enter submission information:update

17303@ZMsnow MINGW64 /j/githome/yunlanzhiyue (master)
$ git config --global core.autocrlf true

17303@ZMsnow MINGW64 /j/githome/yunlanzhiyue (master)
$ git config --global core.safecrlf true

17303@ZMsnow MINGW64 /j/githome/yunlanzhiyue (master)
$


# 正确配置
git config core.autocrlf input
git config core.safecrlf warn
相关推荐
troy1281 小时前
构建金融系统 Reference Data Asset 的完整指南
1024程序员节
鲁Q同志1 小时前
IDEA无限重置激活三十天
intellij-idea·1024程序员节
紧跟先前的步伐1 小时前
Go AI Agent 实战 14|多轮对话与上下文历史管理
人工智能·ai·golang·1024程序员节
ss2731 小时前
AI时代首先数据库-PostgreSQL实战笔记 | 25 PostgreSQL checkpoint与脏页处理机制
1024程序员节
jiangliushi61 小时前
GPT-6.1 Sol 免费用:git status 里中文文件名变成一串数字乱?条命令改好
git·codex·1024程序员节
肖永威1 小时前
AI大模型不是答案机:研发场景下的多模型迭代工作流
人工智能·1024程序员节
INGNIGHT1 小时前
377.组合总和 Ⅳ(背包)
c++·算法·1024程序员节
海盗12341 小时前
微软技术日报 2026-10-24:CA 私钥是 4,Windows 封了中间证书未动父根
人工智能·机器人·aigc·1024程序员节
奶酪博士1 小时前
【1024快乐】用HTML写一个本地版心愿墙页面
html·1024程序员节