So, I’ve run into this a few times now and it seems like bizarre behaviour to me. While committing, git complains about files which have trailing white space, or spaces followed by a tab. While this may not be the nicest formatting, enforcing this to be fixed before committing a file seems odd.
It turns out this is being caused by a pre-commit hook. There are two options you can go with to circumvent the issue.
git commit --no-verify . |
The –no-verify will bypass the pre-commit hooks. This only works on the current commit thought, so you have to add the flag each time you want to commit.
I’ve found that if you
cd .git/hooks/ chmod -x pre-commit |
will disable the pre-commit hooks permanently by removing the executable rights on the file.
Apparently they are disabled by default in newer releases.
Hope this helps someone else out as well.

thanks a lot from Argentina!!!
Apparently this doesn’t work under CygWin. I’ve resorted to re-naming “pre-commit” to “pre-commit.bak”.
Or maybe it’s just that I’m trying to read a CygWin directory from a VirtualBox Linux instance via shared drive…
sorry, I don’t have any experience with using git combined with CygWin. Let me know if you find out a good solution though
GIT + Cygwin. Anyone knows how to turn off the annoying trailing white-space error? (permanently) other than –no-verify
Thanks a lot for the tip. That’s exactly that started to show up after I’ve chmoded my rails app to 0755.
As Alpheus did, renaming the file is the recommended way to turn off hooks on Windows.
Saludos,
Iñaki.
Alternately (on Windows): modify the file. Look at lines 58-60; I think they were. I deleted them.