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
- Get the human's commit email. Use the address tied to their GitHub account, or their GitHub
no-replyaddress. - Write the commit subject and body. Add one blank line before the trailers.
- Add one
Co-authored-byline for each human co-author:git commit -m "Refactor usability tests. Co-authored-by: NAME <NAME@EXAMPLE.COM>" - For kernel work, the human adds their own
Signed-off-byafter review. The AI does not add it. - Check the result. Run
git interpret-trailers --parseon 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
- Human co-author who edited the code: add
Co-authored-bywith their GitHub email. - Accountable human for AI output: name them in the commit or pull request, and have them review and certify the change.
- Linux kernel: the human adds
Signed-off-by. The AI does not.
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.