赞
踩
windows平台进行 git add 时,控制台打印警告
warning: in the working copy of ‘XXX.py’, LF will be replaced by CRLF the next time Git touches it
Dos/Windows平台默认换行符:回车(CR)+换行(LF),即’\r\n’
Mac/Linux平台默认换行符:换行(LF),即’\n’
企业服务器一般都是Linux系统进行管理,所以会有替换换行符的需求
设置方法一:
*适用于Windows系统,且一般为Windows默认设置,会在提交时对换行符进行CRLF - LF的转换,检出时又会进行LF - CRLF的转换。
- #提交时转换为LF,检出时转换为CRLF
- git config --global core.autocrlf true
设置方法二:
*适用于Linux系统,所有换行符都会进行CRLF - LF转换,但操作时不会转换回CRLF。
- #提交时转换为LF,检出时不转换
- git config --global core.autocrlf input
设置方法三:
*适用于Windows系统,且只在Windows上开发的情况。在提交、检出时不会对CRLF/LF换行符进行转换
- #提交检出均不转换
- git config --global core.autocrlf false
文件提交时进行safecrlf检查:
- #拒绝提交包含混合换行符的文件
- git config --global core.safecrlf true
-
- #允许提交包含混合换行符的文件
- git config --global core.safecrlf false
-
- #提交包含混合换行符的文件时给出警告
- git config --global core.safecrlf warn
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。