Answer the question
In order to leave comments, you need to log in
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
git-scm.com/book/en/Customizing-Git-Git-Configuration#Formatting-and-Whitespace
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
~/.gitconfig
[user]
name = name
email = [email protected]
[gui]
[core]
autocrlf = false
safecrlf = true
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.
By the way, if they don’t help you here, then you can safely contact [email protected]: they answer very well.
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question