关于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
相关推荐
普通人65 小时前
WebGL与WebGPU入门指南
开发语言·webgl·1024程序员节
猫猫不是喵喵.21 小时前
从0到1创建一个微服务项目
java·数据库·微服务·1024程序员节
fish_zzzz4 天前
笔记-论数据结构2
1024程序员节
普通人65 天前
PHP文件读写完全指南
开发语言·php·1024程序员节
Martina_03215 天前
AI生成3D场景从白模换成精模后镜头全偏了?用6步检查单位、枢轴与层级替换
图像处理·人工智能·3d·ai·自然语言处理·材质·1024程序员节
星云_byto6 天前
CSS布局
人工智能·机器学习·目标跟踪·1024程序员节
张小姐的猫9 天前
【MySQL】访问 & 数据流动原理
android·数据库·mysql·adb·1024程序员节
工业HMI实战笔记10 天前
印刷电路板HMI:SMT贴装的元件定位界面
制造·设计规范·设计语言·1024程序员节
Martina_032110 天前
AI生成3D模型一合并网格,材质就串色?用6步检查材质槽、UV与图集重映射
图像处理·人工智能·3d·材质·uv·游戏策划·1024程序员节
橙光成长10 天前
android-ad-cleaner:android免 Root 批量关闭系统开屏与营销推送
android·1024程序员节