How do I keep NUL bytes from appearing throughout my GIT repository and commit messages?

Viewed 2896

I have a relatively clean install of Mac OS X Mavericks 10.9 running git version 1.8.5.1; my files are on a mounted SMB share, and I am no longer able to work properly with my GIT repositories because NULL bytes (\0's) keep appearing in all of my version-controlled files... and even in files generated on the fly by GIT.

Typing git commit -m "Test message" by hand, gives me:

error: a NULL byte in commit log message not allowed.
fatal: failed to write commit object

And if I attempt to git commit instead, the default commit message that appears in the pico view looks like this:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch feature/centos_support
# Your branch is up-to-date with 'origin/feature/centos_support'.
#
# Changes to be committed:
#       modified:   README.md
#
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

For a while, manually removing those NULL bytes at the end worked, and I was able to commit, but at intervals even this no longer works (the error is the same as above), and I am forced to trash my entire repo, re-clone it, and redo whatever I was trying to commit.

The fresh repository works as normal for a while, but eventually the NULL characters creep back in, and I have the same problem again.

The same NULL bytes (as above) are appearing at the start and end of files I modify, causing GIT to treat them as binary files until I manually use vi to delete the NULL rows.

  • Has anybody else experienced this, and/or found a solution?
  • What could be causing it?

I would appreciate any help you can offer.

7 Answers
Related