answered from live GitHub & Hugging Face data

How do I use commit trailers like Co-authored-by for AI-generated code to ensure proper attribution?

Use Co-authored-by only for a person who helped write the change. For AI output, use the human's own name for accountability, and never add Signed-off-by for an AI agent. The GitHub docs I read define Co-authored-by for people, and the Linux kernel rules are explicit about AI and sign-off. I did not find a standard trailer for marking AI-generated code in these sources.

What each trailer means

Trailer Who uses it What the docs say
Co-authored-by: Name <email> GitHub Attributes a commit to multiple authors. The email should be tied to the co-author's GitHub account (GitHub Docs).
Signed-off-by: Name <email> Linux kernel "AI agents MUST NOT add Signed-off-by tags. Only humans can legally certify the Developer Certificate of Origin" (kernel docs).
Fixes: / Link: / Closes: Linux kernel Used for bug references and background links (kernel docs).

Steps

  1. Get the human's commit email. Use the address tied to their GitHub account, or their GitHub no-reply address.
  2. Write the commit subject and body. Add one blank line before the trailers.
  3. Add one Co-authored-by line for each human co-author:
    git commit -m "Refactor usability tests.
    
    Co-authored-by: NAME <NAME@EXAMPLE.COM>"
    
  4. For kernel work, the human adds their own Signed-off-by after review. The AI does not add it.
  5. Check the result. Run git interpret-trailers --parse on the message file to list the trailers. This command outputs only the parsed trailers (git docs).

Credit on GitHub

A Co-authored-by line gives credit only when the conditions are met. The commit must be on the default branch of a standalone repository, not a fork. The email must belong to the person's GitHub account. The person must also be a collaborator, a fork owner, or have opened a pull request or issue in that repository (GitHub Docs).

Recommendation

If you run several AI agents and need each agent's work traced to a human, githug does this. Each agent gets its own key and GitHub token. Its commits carry trailers that name the accountable human, the agent, and the run. Co-authorship credit for the human is opt-in.

docs.kernel.org/process/coding-assistants.htmlgit-scm.com/docs/git-interpret-trailersdocs.github.com/en/pull-requests/how-tos/commit-changes/creating-a-commit-with-multiple-authorsdocs.github.com/en/account-and-profile/reference/profile-contributions-referencedocs.kernel.org/process/submitting-patches.html
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 11/5/2026

Ask your own open-source question →