如何配置git repo,以便所有文件都以行尾LF(而不是CFLF)存储? [英] how to config git repo so that all files are stored with line-ending LF ( not CFLF ) ?

查看:251
本文介绍了如何配置git repo,以便所有文件都以行尾LF(而不是CFLF)存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于特定的github回购(仅),我需要确保推送的所有文本文件都有LF行结束符(不是CRLF)。

此外, down回购文件应该保留LF行结束在客户端OSX或Windows上。



这可能吗? 尝试添加一个名为 .gitattributes 的文件并附带以下内容:

  * eol = lf 

到您的回购。然后,无论开发者使用什么设置,所有文件将始终使用 LF core.autocrlf

请记住,它会将 CRLF 更改为 LF 在二进制文件中提交(例如zip,jar,png等)。


For a specific github repo ( only ) I need to make sure that all text files pushed have LF line-ending ( not CRLF ).

Further, pulled-down repo files should retain LF line-ending on clients either OSX or Windows.

Is this possible ?

解决方案

Try to add a file named .gitattributes with the following contents:

*  eol=lf

to your repo. Then no matter what settings for core.autocrlf developers use, all the files will always use LF.

Just keep in mind, that it will change CRLF into LF upon commit in binary files also (like zip, jar, png, etc.).

这篇关于如何配置git repo,以便所有文件都以行尾LF(而不是CFLF)存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆