用cygwin和Github for Windows的行结尾 [英] Line endings with cygwin and Github for Windows

查看:128
本文介绍了用cygwin和Github for Windows的行结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用Github for Windows应用程序以及git在命令行中使用Cygwin(在Windows上)来处理我的git项目。

I'm want to be able to work on my git projects using both the Github for Windows application as well as git in the command line using Cygwin (on Windows).

但是当我从一个切换到另一个时,我仍然遇到行尾的问题。

But I keep on getting problems with the line endings when I switch from one to the other.

如果使用命令行工具repo没有更改,它将要使用Github应用程序修改所有文件。如果我用Github应用程序做的更改,然后将再次想用命令行工具更改它。

If with the command line tool the repo has no changes, it will want to modify all the files with the Github app. If I do the changes with the Github app it will then again want to change it with the command line tool.

经过相当数量的测试后,我无法使用这两种工具。

After a fair amount of testing I couldn't make it work for both tools.

什么会使它工作?在.gitatributes我目前设置:
* text = auto
但它不帮助

What would make it work? In the .gitatributes I currently have set: * text=auto But it doesn't help

推荐答案

这是一个GHfW错误,当您的存储库配置和您的资料库中的数据不一致时会发生。

This is a GHfW bug which occurs when your repository configuration and the data in your repository do not agree.

如果配置要转换为CRLF行尾的文件 - 例如,通过将 core.autocrlf 设置为 true ,但是您的存储库中有已经在CRLF中的blob格式(可能是因为某人没有将 core.autocrlf 设置为true),则可能会出现此问题。

If you configure a file to be translated to CRLF line endings - by setting core.autocrlf to true, for example, but you have blobs in your repository that are already in CRLF format (likely because somebody hasn't set core.autocrlf to true) then this problem can occur.

这种情况下,GHfW翻译库中的CRLF不同于msysgit。因此,一些或所有文件显得很脏。

In this case, GHfW translates the CRLFs in the repository differently than msysgit. As a result, some or all files appeared dirty.

我会建议您的团队CRLF一致的方法,以避免任何歧义的git工具,他们应该做你的行结束。也就是说,这个bug最近修复在libgit2,这个库是GHfW的基础,应该很快就会进入GHfW。

I would recommend a consistent approach to your CRLF across your team to avoid any ambiguity by git tools as to what they should do with your line endings. That said, this bug was recently fixed in libgit2, the library that underlies GHfW, and should makes its way into GHfW soon.

这篇关于用cygwin和Github for Windows的行结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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