Skip to content

Instantly share code, notes, and snippets.

@natritmeyer
Created September 1, 2025 15:49
Show Gist options
  • Select an option

  • Save natritmeyer/f3b88436382cc82374afa7b1f12405b4 to your computer and use it in GitHub Desktop.

Select an option

Save natritmeyer/f3b88436382cc82374afa7b1f12405b4 to your computer and use it in GitHub Desktop.
Maven wrapper files and their line endings in git
mvnw text eol=lf
mvnw.cmd text eol=crlf

If you've got core.autocrlf=input set in your git config and you try to git-add newly-created maven wrapper files to your project on macOS/linux (i.e. the mvnw and mvnw.cmd) then you'll likely see the following output:

$ git add .
warning: in the working copy of 'mvnw.cmd', CRLF will be replaced by LF the next time Git touches it

The easiest way to deal with this is to use a .gitattributes file (add it to your repo root) to force the right line endings for the two maven wrapper scripts. See attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment