git gui :Updating the Git index failed. A rescan will be automatically started to res

这个是由于unix系统的换行符和windows的换行符不一致造成的结果。你在安装git的时候,设置了成使用LF,即unix换行符,可是你是在windows下进行文件编辑的,所以会出现上面的警告。其实这也没什么问题的,git只是自动帮你将windows换行符替换为Unix换行符。

 

I faced similar issues and decided to have a closer look to my configuration.

New Line Characters on Windows / Linux / MAC:

  1. MAC OS before X: \r = CR (Carriage Return)
  2. MAC OS X / UNIX: \n = LF (Line Feed)
  3. Windows: \r\n = CR + LF

Don't panic. Git can handle the conversion between platforms for you.

Git should store the line ending as LF in the repo.

Set it to;

TRUE - If you are on Windows:

git config --global core.autocrlf true

This converts LF endings into CRLF when you check out code.

INPUT - If you are on a MAC/LINUX:

You don't need to convert anything, Git uses LF and your MAC uses LF.

But, you can tell git to convert any CRLF if one pass through:

git config --global core.autocrlf input

False - Not recommened

I don't recommend this, but just for the sake of this explanation:

If you are a windows dev only working on windows machine and you are 100% sure you will never work with people on MAC:

git config --global core.autocrlf false

UPDATE:

As commented below, I didn't mention the .gitattributes where one can default these settings for a project.

If you havetime, here is the doc: http://git-scm.com/docs/gitattributes

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值