git add . 报错 LF will be replaced by CRLF the next time Git touches it

git add . 报错

在这里插入图片描述

原因分析
Dos/Windows平台默认换行符:回车(CR+换行(LF),即’\r\n’
Mac/Linux平台默认换行符:换行(LF),即’\n’
企业服务器一般都是Linux系统进行管理,所以会有替换换行符的需求
解决办法
//解决方法1:在你提交时转换为LF,检出时转换为CRLF
//此方法适用于Windows系统,且一般为Windows默认设置会在提交时对换行符进行CRLF - LF的转换,检出时又会进行LF - CRLF的转换。)
	git config --global core.autocrlf true
//解决方法2:提交时转换为LF,检出时不转换
//此方法适用于Linux系统,所有换行符都会进行CRLF - LF转换,但操作时不会转换回CRLF
	git config --global core.autocrlf input
//解决方法2:提交检出都不进行转换
//此方法适用于Windows系统,且只在Windows上开发的情况。在提交、检出时不会对CRLF/LF换行符进行转换
	git config --global core.autocrlf false

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用 引用 引用根据这些引用内容,警告信息"warning: in the working copy of 'androidPrivacy.json', LF will be replaced by CRLF the next time Git touches it"是在提醒用户在Git操作中,回车和换行的转换将会发生。这是因为Git会在提交时对换行符进行转换以保持统一性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [warning: in the working copy of ‘App.vue‘, LF will be replaced by CRLF the next time Git touches ...](https://blog.csdn.net/weixin_44953057/article/details/129644219)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Git: ‘LF will be replaced by CRLF the next time Git touches it‘ 问题解决与思考](https://blog.csdn.net/Babylonxun/article/details/126598477)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [warning: in the working copy of ‘...‘, LF will be replaced by CRLF the next time Git touche](https://blog.csdn.net/weixin_55252589/article/details/129017650)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值