PhpStorm + GIT行结束从LF变为CRLF [英] PhpStorm + GIT line endings changing from LF to CRLF

查看:1718
本文介绍了PhpStorm + GIT行结束从LF变为CRLF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将PhpStorm行末尾设置为LF,但是当我提交给github时,有时我会看到一些文件再次以CRLF行结尾(我在Windows上工作)出现。



它发生在我编辑过的相同文件中,没有人在我的提交/推送到存储库之间对它们进行编辑。这是非常令人烦恼的,我需要经常更改行结尾到同一个文件。这可能是什么,以及如何解决它?



我也检查选项警告如果CRLF行分隔符即将被提交



编辑



我的本​​地git配置是这样的:

< pre $ [core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remoteorigin]
url = https://github.com/*
fetch = + refs / heads / * :refs / remotes / origin / *
[branchdevelop]
remote = origin
merge = refs / heads / develop

我的全局配置是这样的:

  [user] 
name = *
email = *
[core]
autocrlf = false

我的全系统配置是这样的:

  [core] 
symlinks = false
autocrlf =假
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
格式= html
[http]
sslCAinfo = /bin/curl-ca-bundle.crt
[sendemail]
smtpserver = /bin/msmtp.exe

[diffastextplain]
textconv = astextplain
[rebase]
autosquash = true

以及PhpStorm中的GIT设置: b
$ b

解决方案

经过测试显然不是PhpStorm问题,而是GIT配置问题。 / p>

似乎在Windows上需要设置:

  git config --global core.autocrlf input 

还有

  git config --global core.eol lf 

使其工作。

I have set in my PhpStorm line endings to LF but when I commit to github, sometimes I see some of the files again appear with CRLF line ending (I work on Windows).

It happens with the same files I've edited and nobody edited them between my commits/pushes to repository. It's very irritating and I need to often change line endings to the same file. What could it be and how to fix it?

I also have checked option "Warn if CRLF line separators are about to be commited"

EDIT

My local git config is this:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    url = https://github.com/*
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "develop"]
    remote = origin
    merge = refs/heads/develop

My global config is this:

[user]
    name = *
    email = *
[core]
    autocrlf = false

My systemwide config is this:

[core]
    symlinks = false
    autocrlf = false
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = true
[pack]
    packSizeLimit = 2g
[help]
    format = html
[http]
    sslCAinfo = /bin/curl-ca-bundle.crt
[sendemail]
    smtpserver = /bin/msmtp.exe

[diff "astextplain"]
    textconv = astextplain
[rebase]
    autosquash = true

And my GIT settings in PhpStorm:

解决方案

After tests it was obviously not PhpStorm issue but GIT config issue.

It seems that on Windows it's necessary to set:

git config --global core.autocrlf input

but also

git config --global core.eol lf

to make it work.

这篇关于PhpStorm + GIT行结束从LF变为CRLF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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