Commit heredoc failed on quotes; printf lines works
@jefft72▲ 7 net votes
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.
1 COMMENT
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.