1

I work on a group Java project using the Netbeans IDE on Windows, while some of the others use Linux. This creates conflicts with different end of line characters, which one can apparently solve using "git config core.autocrlf true". However, doing this through cmd returns:

"'git' is not recognized as an internal or external command,operable program or batch file."

This is because git is integrated in Netbeans, and so not installed (and configurable) standalone.

How does one do this configuration within Netbeans? Googling only returns installing git within Netbeans, but not its settings.

The Netbeans version is 11.3.

Kotlopou
  • 415
  • 3
  • 13

1 Answers1

1

First, it is better to have a separate Git for Windows instance just for that kind of settings: you won't depend on the partial Git configuration support of NetBeans that way.
Simply uncompress the latest release (like PortableGit-2.27.0-rc1-64-bit.7z.exe) anywhere you want.

Second, core.autocrlf is generally:

  • better set at the global level
  • set to false in order for Git to not change EOL automatically

That is:

git config --global core.autocrlf false

Third, eol directives are best specified in a .gitattributes file, part of your codebase (therefore automatically applied by anyone working on your repository).
See for instance "What's the best CRLF (carriage return, line feed) handling strategy with Git?".
For instance:

*.bat           text eol=crlf # Treat as text. Checkout and add with eol=crlf

Then switch back to Netbeans after having cloned the repository one more time in a new folder, to check those directives are correctly applied.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250