A
A
arturgspb2012-07-05 11:19:45
git
arturgspb, 2012-07-05 11:19:45

How to solve Git + phpStorm line endings issue?

Installed phpstorm. Everything is cool, except that I can no longer work with git as I used to. At home, the main OS is Windows (because I'm married ;) ), I have a virtual machine with debian and I work with it through putty (I run sh, php-cli scripts, etc.).
The problem is that when checking out a project from git, phpStorm saves some files with end line Dos / Window instead of Unix, so bash files just stopped working for me. It seems that he went through all the phpStorm settings - set UTF-8 in Template Settings and other settings, set checkout and as-in commit in msysgit (while merging the project again each time). Nothing helped.
I just tried to download the project in Explorer via TortoiseGit - everything is cool, everything is in Unix UTF-8.
Tell me what is the magic and how to curb phpStorm or msysgit so that it checks out in Unix UTF-8?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
DevMan, 2012-07-05
@arturgspb

git-scm.com/book/en/Customizing-Git-Git-Configuration#Formatting-and-Whitespace

N
Nazar Mokrinsky, 2012-07-05
@nazarpc

In the PhpStorm settings there is an option to end the line, as well as check it before committing (it can bring everything to the desired form itself).
Settings->Project Settings->Code Style->General->Line separator (for new files)
Settings->Project Settings->Version Control->Git->Line Separators Conversion

M
Mikhail Osher, 2012-07-05
@miraage

~/.gitconfig

[user]
  name = name
  email = [email protected]
[gui]
[core]
  autocrlf = false
  safecrlf = true

E
EugeneOZ, 2012-07-05
@EugeneOZ

Put the Webmaster plugin (in the list of plugins by search), there is such a thing.
When installing a git under Windows, you can ask him what to do with EOL. Choose the second option.

E
edelweard, 2012-07-05
@edelweard

By the way, if they don’t help you here, then you can safely contact [email protected]: they answer very well.

E
edelweard, 2012-07-05
@edelweard

1. In PhpStorm, there is no magic when checking out. It always uses the line endings that were originally in the file (with the exception of the option to change them on commit, which nazarpc mentioned).
2. If you want to keep the endings on checkout, set core.autocrlf = false or input.
3. If you get different results when checking out from PhpStorm and from the console, it means that in the PhpStorm settings you have the path to another Git installation (with different core.autocrlf settings). Because when Checkout from Git, PhpStorm simply calls git clone. Check it.

Q
Quber, 2015-07-08
@Quber

bash files work equally well on both Windows and Linux

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question