git commit You have some suspicious patch lines

git commit giving me the following message

* You have some suspicious patch lines:
* In projects/bong/traid/apps/controller/project.php
* trailing whitespace (line 220)
* trailing whitespace (line 223)

What does that mean ?

  • Github remote push pack size exceeded
  • Git ssh connection refused with the following format
  • How to undo the last commit in git
  • How much overhead time and learning time to use version control?
  • How to commit/push a Git tag with Gradle?
  • How to git cherrypick all changes introduced in specific branch
  • How to use Bower with private Bitbucket repository?
  • How to make git merge include summary of each commit?
  • Ionic Build iOS and Xcode Build not deploying most Recent Ionic 2 Beta 10 build
  • create a git symbolic ref in remote repository
  • how to easily select a single commit when a range must be specified?
  • Checkout/List remote branches in git-python
  • 3 Solutions collect form web for “git commit You have some suspicious patch lines”

    That happens when the file has trailing whitespace, if you run:

    git commit --no-verify

    it will commit ok.

    I find it disturbing to just deactivate pre-commit altogether. If you have a look at the content of .git/hooks/pre-commit, it also checks for unresolved merge conflicts, and I would like to continue to check for those!

    Towards the end of the file it runs some regular expressions that check for spaces at line endings and untidy tab characters. I just commented out these lines so it doesn’t look for those, and I got rid of the pre-commit warning problem.

     55     if (s/^\+//) {
     56         $lineno++;
     57         chomp;
     **58         # if (/\s$/) {
     59         # bad_line("trailing whitespace", $_);
     60         # }
     61         # if (/^\s* \t/) {
     62         # bad_line("indent SP followed by a TAB", $_);
     63         # }**
     64         if (/^([])\1{6} |^={7}$/) {
     65         bad_line("unresolved merge conflict", $_);
     66         }
     67     }

    In short, it means that you have trailing white space on the lines mentioned. Trailing white is a bit of an odd choice, and sometimes is a compiler error or other error waiting to happen.

    You can either clean up those lines, or you can force the commit just this time by adding the –no-verify flag to your git commit.

    Alternatively, you can just turn off this checking by disabling pre-commit hooks, like this:
    cd .git/hooks/
    chmod -x pre-commit

    BTW, this answer is extracted from:

    Git Baby is a git and github fan, let's start git clone.