claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Commit messages polluted by `Generated with [Claude Code](https://claude.ai/code)` entries

Open MarcinOrlowski opened this issue 7 months ago • 9 comments

Despite clear rules in CLAUDE.md to not do that, I still need to combat Claude spamming my commit messages with

│   🤖 Generated with [Claude Code](https://claude.ai/code)                            │
│                                                                                      │
│   Co-Authored-By: Claude <[email protected]>"                                    │

Can you please stop or at least add option to opt-out?

MarcinOrlowski avatar May 24 '25 18:05 MarcinOrlowski

https://docs.anthropic.com/en/docs/claude-code/settings#available-settings

Key Description Example
apiKeyHelper Custom script to generate an Anthropic API key /bin/generate_temp_api_key.sh
cleanupPeriodDays How long to locally retain chat transcripts (default: 30 days) 20
env Environment variables that will be applied to every session {"FOO": "bar"}
includeCoAuthoredBy Whether to include the co-authored-by Claude byline in git commits and pull requests (default: true) false

At least try reading the docs folks

hesreallyhim avatar May 27 '25 05:05 hesreallyhim

% claude config set includeCoAuthoredBy false
Error: Cannot set 'includeCoAuthoredBy'. Only these keys can be modified: allowedTools, dontCrawlDirectory, hasTrustDialogAccepted, hasCompletedProjectOnboarding, ignorePatterns. Did you mean --global?
% claude config set -g includeCoAuthoredBy false
Error: Cannot set 'includeCoAuthoredBy'. Only these keys can be modified: apiKeyHelper, autoUpdaterStatus, theme, verbose, preferredNotifChannel, shiftEnterKeyBindingInstalled, editorMode, hasUsedBackslashReturn, supervisorMode, autoCompactEnabled, diffTool, env, tipsHistory, parallelTasksCount, todoFeatureEnabled, messageIdleNotifThresholdMs

dragonfax avatar May 29 '25 17:05 dragonfax

@dragonfax OK sorry to hear that, the documentation is always changing but this... was a feature.

hesreallyhim avatar May 29 '25 20:05 hesreallyhim

Looks like the opt out includeCoAuthoredBy is broken - would be nice if it was either fixed, or if the documentation was fixed so people don't waste time trying something that doesn't work.

philrosenthal avatar May 31 '25 17:05 philrosenthal

I manually added "includeCoAuthoredBy": false to ~/.claude/settings.local.json and I believe it worked.

MarcinOrlowski avatar May 31 '25 19:05 MarcinOrlowski

I guess the CLI hasn't caught up, but it did work for me in ~/.claude/settings.json as well. So go for it.

dragonfax avatar Jun 03 '25 04:06 dragonfax

I didn't really mind the "Co-Authored-By: Claude [email protected]" but it's causing the GitHub UI to tag some random guy (who has presumably claimed that's his email address?) in my commits which is annoying. So I've disabled it now, thanks to the comments here

Image

btabram avatar Jun 05 '25 15:06 btabram

Same issue, same user. I'm sure this will be fixed by Anthropic or Github, but cost me 2 hrs reviewing all the security settings, collaborators, keys, etc. Just heads up for others out there: In addition to the setting described by others, good idea to setup GPG key, so future commits will be verified. Then unverified or partially verified commits will stand out visually.

MoHimedan avatar Jun 05 '25 15:06 MoHimedan

test

tatsunotakumi avatar Jun 19 '25 14:06 tatsunotakumi

I guess the CLI hasn't caught up, but it did work for me in ~/.claude/settings.json as well. So go for it.

Not working on 1.0.43

ardyfeb avatar Jul 06 '25 16:07 ardyfeb

I had the ignore flag in the project settings.local.json - claude delete it, along with my ENV vars.... I swear it's one step forward 2 steps back sometimes...

digitalsparky avatar Jul 08 '25 10:07 digitalsparky

Based on similar closed issues (#617, #4204), here's the solution:

Solution

Manually add the includeCoAuthoredBy setting to your settings file:

~/.claude/settings.json (global) or .claude/settings.json (project-specific):

{
  "includeCoAuthoredBy": false
}

Note: The claude config set command doesn't support this setting - manual editing is required.

This disables both the "🤖 Generated with [Claude Code]" line and "Co-Authored-By" attribution.

See settings documentation for more details.

🤖 Generated with Claude Code

bcherny avatar Jul 25 '25 21:07 bcherny

FYI: Here's a complete summary of commands to fully clean up commits with Co-Authored-By attributions:

Complete Cleanup Commands

1. Create backup branch (safety first)

git branch backup-before-removing-attributions

2. Remove attributions from commit messages

FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --msg-filter 'sed -e "/^Co-Authored-By:/d" -e "/🤖 Generated with \[Claude Code\]/d" | sed -e :a -e 
  "/^\s*$/{\$d;N;ba" -e "}"' -- --all

3. Clean up filter-branch backup refs

git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d

4. Delete backup branch (optional - only after verifying success)

git branch -D backup-before-removing-attributions

5. Expire reflog immediately (optional - for complete removal)

git reflog expire --expire=now --all
git reflog expire --expire-unreachable=now --all

6. Aggressive garbage collection (optional - removes old objects)

git gc --prune=now --aggressive

7. Force push to remote (updates remote history)

git push --force-with-lease origin main

Notes:

  • Steps 1-3 are essential
  • Steps 4-6 are optional for complete local cleanup
  • Step 7 updates the remote repository
  • The remote will eventually garbage collect old commits on its own
  • --force-with-lease is safer than --force as it prevents overwriting others' work

n8behavior avatar Jul 29 '25 14:07 n8behavior

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 06 '25 14:08 github-actions[bot]