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

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 14 comments · opened May 24, 2025 · closed Jul 26, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

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 <noreply@anthropic.com>"                                    │

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

View original on GitHub ↗

14 Comments

hesreallyhim · 1 year ago

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

dragonfax · 1 year ago
% 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
hesreallyhim · 1 year ago

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

philrosenthal · 1 year ago

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.

MarcinOrlowski · 1 year ago

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

dragonfax · 1 year ago

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

btabram · 1 year ago

I didn't really mind the "Co-Authored-By: Claude <noreply@anthropic.com>" 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

<img width="595" alt="Image" src="https://github.com/user-attachments/assets/c15a63b0-745f-4877-84b9-07006a1a9ff4" />

MoHimedan · 1 year ago

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.

tatsunotakumi · 1 year ago

test

ardyfeb · 1 year ago
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

digitalsparky · 1 year ago

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...

bcherny collaborator · 1 year ago

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

n8behavior · 1 year ago

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
github-actions[bot] · 1 year ago

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.