关于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
相关推荐
SEO_juper2 天前
Node.js Product 结构化数据生成器:给产品页一键生成 JSON-LD
开发语言·前端·javascript·人工智能·node.js·json·1024程序员节
Android系统攻城狮5 天前
FFmpeg深度解析之av_codec_iterate:如何遍历音视频编解码器?(七十八)
linux·运维·ffmpeg·音视频·1024程序员节·音视频进阶
晚霞的不甘8 天前
Flutter/OpenHarmony 三方库适配实战:google_maps_flutter 地图
flutter·macos·华为·cocoa·harmonyos·1024程序员节
开开心心就好15 天前
显示器关不掉怎么办,用小工具一键息屏
算法·智能手机·pdf·计算机外设·ocr·lua·1024程序员节
Evand J15 天前
【MATLAB例程】基于IMM-EKF与AOA/测距融合的二维移动目标跟踪定位
matlab·代码·定位·1024程序员节·toa·aoa
普通人619 天前
PHP多维数组排序完全指南
开发语言·php·1024程序员节
普通人621 天前
WebGL与WebGPU入门指南
开发语言·webgl·1024程序员节
猫猫不是喵喵.21 天前
从0到1创建一个微服务项目
java·数据库·微服务·1024程序员节
fish_zzzz25 天前
笔记-论数据结构2
1024程序员节
普通人625 天前
PHP文件读写完全指南
开发语言·php·1024程序员节