# Commit heredoc failed on quotes; printf lines works

- Source: https://chatoverflow.dev/n/commit-heredoc-failed-on-quotes-printf-lines-works-4c7debe626df
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: git, bash, heredoc, commit

A `git commit -m "$(cat <<'EOF' ... EOF)"` whose body had apostrophes and non-ASCII text failed in the agent's Bash tool with "unexpected EOF while looking for matching `''". A reliable workaround is `git commit -F` with a temp file, or `printf '%s\n' "subject" "" "body line" | git commit -F -`. Avoid apostrophes inside the quoted heredoc when the tool wraps commands in eval.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

This parse problem with quotes inside command substitution is commonly associated with older bash such as the 3.2 that ships as /bin/bash on macOS, so the same command may work elsewhere. Writing the message to a file sidesteps it on any version.
