claude-code - 💡(How to fix) Fix attribution.commit: "" does not disable Co-Authored-By trailer [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45137Fetched 2026-04-09 08:12:20
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Root Cause

From the compiled binary (v2.1.85), the relevant logic:

function fVH() {
  // ...
  let K = `Co-Authored-By: ${q} <[email protected]>`;
  let O = R8(); // reads settings
  
  if (O.attribution)
    return { commit: O.attribution.commit ?? K, pr: O.attribution.pr ?? $ };
  
  if (O.includeCoAuthoredBy === false)
    return { commit: "", pr: "" };
  
  return { commit: K, pr: $ };
}

The ?? (nullish coalescing) logic is correct — "" ?? K should return "". So fVH() likely returns { commit: "", pr: "" } as expected.

However, the caller (the built-in /commit skill prompt via Rs1()) appears to inject the trailer into the commit message regardless, possibly through the system prompt instructing the model to add it, or through a separate code path that doesn't check the return value properly.

Fix Action

Workaround

A commit-msg git hook that strips the trailer:

#!/bin/sh
sed -i '' '/^Co-Authored-By:.*<[email protected]>/d' "$1"

Code Example

{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}

---

function fVH() {
  // ...
  let K = `Co-Authored-By: ${q} <[email protected]>`;
  let O = R8(); // reads settings
  
  if (O.attribution)
    return { commit: O.attribution.commit ?? K, pr: O.attribution.pr ?? $ };
  
  if (O.includeCoAuthoredBy === false)
    return { commit: "", pr: "" };
  
  return { commit: K, pr: $ };
}

---

#!/bin/sh
sed -i '' '/^Co-Authored-By:.*<[email protected]>/d' "$1"
RAW_BUFFERClick to expand / collapse

Bug

Setting attribution.commit to "" (empty string) in ~/.claude/settings.json does not disable the Co-Authored-By trailer on commits. The docs and the embedded help text both state:

Set commit or pr to empty string "" to hide that attribution.

But commits still get the trailer appended.

Repro

  1. Set ~/.claude/settings.json:
{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}
  1. Start a new Claude Code session
  2. Ask Claude to make a change and commit it (or use /commit)
  3. The commit message includes Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

Analysis

From the compiled binary (v2.1.85), the relevant logic:

function fVH() {
  // ...
  let K = `Co-Authored-By: ${q} <[email protected]>`;
  let O = R8(); // reads settings
  
  if (O.attribution)
    return { commit: O.attribution.commit ?? K, pr: O.attribution.pr ?? $ };
  
  if (O.includeCoAuthoredBy === false)
    return { commit: "", pr: "" };
  
  return { commit: K, pr: $ };
}

The ?? (nullish coalescing) logic is correct — "" ?? K should return "". So fVH() likely returns { commit: "", pr: "" } as expected.

However, the caller (the built-in /commit skill prompt via Rs1()) appears to inject the trailer into the commit message regardless, possibly through the system prompt instructing the model to add it, or through a separate code path that doesn't check the return value properly.

Expected behavior

With attribution.commit: "", no Co-Authored-By trailer should appear in commit messages.

Workaround

A commit-msg git hook that strips the trailer:

#!/bin/sh
sed -i '' '/^Co-Authored-By:.*<[email protected]>/d' "$1"

Environment

  • Claude Code v2.1.85
  • macOS (Darwin 24.6.0, arm64)
  • Setting was in ~/.claude/settings.json (user scope), last modified before the affected commits
  • New sessions still produce the trailer

extent analysis

TL;DR

Setting an empty string for attribution.commit in ~/.claude/settings.json does not disable the Co-Authored-By trailer due to a potential issue in the caller logic, and a workaround using a commit-msg git hook can be applied.

Guidance

  • The issue seems to stem from the caller (/commit skill prompt via Rs1()) not properly checking the return value of fVH() or injecting the trailer through a separate code path.
  • To verify the issue, check the commit messages for the presence of the Co-Authored-By trailer after setting attribution.commit to an empty string.
  • Apply the provided commit-msg git hook workaround to strip the trailer from commit messages.
  • Investigate the Rs1() function and its interaction with fVH() to identify the root cause of the issue.

Example

#!/bin/sh
sed -i '' '/^Co-Authored-By:.*<[email protected]>/d' "$1"

This commit-msg git hook can be used to strip the Co-Authored-By trailer from commit messages.

Notes

The workaround may not be suitable for all environments or use cases, and the root cause of the issue should be investigated to provide a more permanent solution.

Recommendation

Apply the workaround using the commit-msg git hook, as it provides a reliable way to strip the Co-Authored-By trailer from commit messages until the root cause is addressed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

With attribution.commit: "", no Co-Authored-By trailer should appear in commit messages.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING