Maximum commit message size

Is there any size limit to the Git commit message?
I searched trough the web but cannot find any relevant mention about this except this one.

However, that one does not answer my question.

  • How to add git file status to vim's statusline?
  • Reuse GIT_WORK_TREE in post-receive hook to rm a few files
  • Xcode 4.4.1: git no longer showing modifications
  • Git went back 5 commits and forgot to create a new branch, how to come back?
  • How to reduce disk space usage in a large repository?
  • Moving incremental project folders to Git as commits
  • How to create a git clone for viewing only
  • git can't remember password
  • Git - “Your branch is ahead of 'origin/master' by 3 commits.”
  • Git hook to prevent creating new branches from specific branches
  • Git workflow to distribute changes to several branches
  • Project management software, available options
  • 2 Solutions collect form web for “Maximum commit message size”

    https://github.com/git/git/blob/master/strbuf.h defines the len field to be a size_t. So at the very least, the maximum length has an upper bound at the maximum value of size_t on your platform of choice.

    Empirically, I think the answer is no. This worked (that’s a ~100MB commit message):

    yes | head -c 100000000 | git commit -F - > /dev/null
    

    Command parts explanation:

    • yes repeats “y\n” forever
    • head -c 100000000 takes only the first 100,000,000 bytes (~100MB)
    • git commit -F - commits with the passed-in commit message (this won’t work if you haven’t staged any changes to commit)
    • > /dev/null hides the output from the command, which includes Git repeating back the very long commit message
    Git Baby is a git and github fan, let's start git clone.