How to Use Git with Claude Code: Understanding the Co-Authored-By Attribution

AI, Devops & Infrastructure, Git, and News

How to Use Git with Claude Code: Understanding the Co-Authored-By Attribution

AI-powered coding assistants are transforming how developers work, and Anthropic's Claude Code is at the forefront of this revolution. One of its most discussed features is how it handles Git commits—specifically, the automatic co-authored-by attribution that lets teams know when AI was involved in creating code. In this guide, we'll walk through using Git with Claude Code and help you decide whether to keep or disable this attribution based on your team's needs.

What is Claude Code?

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling Git workflows through natural language commands. Many engineers at Anthropic themselves report using Claude for 90%+ of their Git interactions.

Beyond simple code generation, Claude Code can:

  • Search git history to answer questions like "What changes made it into v1.2.3?" or "Why was this API designed this way?"
  • Write commit messages by analysing your changes and recent history
  • Handle complex git operations like reverting files, resolving rebase conflicts, and comparing patches
  • Create and manage pull requests with comprehensive descriptions

How Claude Code Handles Git Commits

When Claude Code creates a commit on your behalf, it automatically adds attribution to the commit message by default. This looks something like:

fix: resolve authentication bug in login flow

Fixes the issue where users were being logged out unexpectedly
after session timeout.

Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>

GitHub recognises this Co-Authored-By trailer format and displays Claude in the "Co-authors" list for that commit. This makes it visible at a glance when reviewing the repository's history or pull requests that AI assistance was used.

Setting Up Git with Claude Code: A Step-by-Step Guide

Step 1: Install Claude Code

First, ensure you have Node.js 18 or higher installed, then install Claude Code globally:

npm install -g @anthropic-ai/claude-code

Step 2: Authenticate with Anthropic

Launch Claude Code in your terminal:

claude

Follow the prompts to authenticate with your Anthropic account. Once authenticated, Claude Code will be ready to use.

Step 3: Navigate to Your Git Repository

Change to your project directory:

cd /path/to/your/project

Then start Claude Code within that directory:

claude

Step 4: Let Claude Handle Git Operations

You can now use natural language to interact with Git. Try commands like:

  • "Show me what files have changed"
  • "Create a commit with an appropriate message for my changes"
  • "Create a pull request for this branch"
  • "Help me resolve these merge conflicts"
  • "What changed between v1.0 and v1.1?"

Claude will analyse your codebase, understand the context of your changes, and generate meaningful commit messages that accurately describe what changed and why.

The Co-Authored-By Debate: To Disclose or Not?

The automatic attribution feature has sparked interesting discussions in the developer community. Let's explore both perspectives to help you make an informed decision for your team.

Why Some Teams Keep the Attribution

Transparency and accountability. In an era where AI-generated code is becoming common, many organisations value transparency about how their code was written. The attribution creates a clear audit trail that helps teams understand their development process.

Quality assessment for maintainers. Open source maintainers often find the disclosure helpful. As one developer noted in the Ghostty project's discussion on AI disclosure: knowing that AI was involved helps maintainers "assess how much attention to give a PR" and understand whether they're coaching a human contributor or reviewing AI-generated code.

Honest git history. Some developers argue that attribution makes the git history more honest. It tells a story about collaboration between human developers and AI tools, which can be valuable for understanding how a project evolved.

Compliance requirements. Some organisations, particularly in regulated industries, are implementing policies that require disclosure of AI tool usage. The European Union's AI Act, for instance, includes provisions about transparency in AI systems.

Building trust. Rather than hiding AI involvement, being upfront about it can actually build trust. When teams are transparent about their tools, it demonstrates confidence that the output meets their standards regardless of how it was produced.

Why Some Teams Disable It

Commit message standards. Many organisations have strict commit message conventions that don't accommodate attribution lines. The extra text can conflict with tooling that parses commit messages or with established formatting requirements.

Personal or professional preference. Some developers prefer to maintain sole authorship of their commits. As one developer put it: "Maybe you're working on a personal project, maybe you have contribution requirements at work, or maybe you just don't want an AI showing up in your GitHub contribution graph."

Tool vs. creator debate. Some argue that AI should be viewed as a tool, not a collaborator. The analogy often used: "When we build a house, we don't credit the hammer and saw as co-authors." From this perspective, the human developer who directs, reviews, and approves the code is the true author.

Clean git history. For some projects, keeping the commit history streamlined and focused purely on the code changes is a priority. The attribution can be seen as noise that clutters the history.

How to Configure the Co-Authored-By Setting

Claude Code provides straightforward configuration options through the settings.json file. Here's how to configure it:

Step 1: Locate Your Settings File

The settings file location depends on your operating system:

  • macOS/Linux: ~/.claude/settings.json
  • Windows: %APPDATA%\claude-code\settings.json

If the file doesn't exist, create it.

Step 2: Configure the Settings

To disable the co-authored-by attribution, add the following to your settings.json:

{
  "includeCoAuthoredBy": false,
  "gitAttribution": false
}

To keep the attribution (which is the default), you don't need to add anything, but you can explicitly set:

{
  "includeCoAuthoredBy": true
}

Understanding the Settings

  • includeCoAuthoredBy: Controls whether Claude adds the "Co-Authored-By: Claude" line to commit messages
  • gitAttribution: Disables all forms of Git attribution that Claude might add, including the "Generated with Claude Code" line

Project-Level Configuration

You can also configure these settings at the project level for team-wide consistency:

  • .claude/settings.json - Checked into source control, shared with your team
  • .claude/settings.local.json - Not checked in, useful for personal preferences

This is particularly useful when different projects have different requirements—perhaps your open source contributions need attribution while your internal projects don't.

Using CLAUDE.md for Additional Control

You can also include Git commit instructions in your project's CLAUDE.md file to guide Claude's behaviour:

## Git Commit Guidelines

When creating commits:
- Follow conventional commit format
- Keep the first line under 50 characters
- Do not include AI attribution in commit messages

Best Practices for Git Workflows with Claude Code

Regardless of your attribution preferences, here are some best practices for getting the most out of Claude Code's Git integration:

Make smaller, focused commits. Rather than large, multi-purpose commits, smaller ones allow Claude to generate more precise commit messages and better understand your changes.

Use descriptive branch names. Names that indicate the purpose of changes help Claude understand the context when creating PRs or analysing branches.

Specify commit conventions. If you use Conventional Commits or another standard, tell Claude to follow it consistently. This improves the readability and structure of your project history.

Review AI-generated commits. Always review the commit messages and content Claude generates before pushing. You're ultimately responsible for the code that goes into your repository.

Leverage Claude for git archaeology. Claude excels at searching through git history. Use it to answer questions about past changes, understand why decisions were made, or find when bugs were introduced.

Conclusion

Claude Code's Git integration represents a significant step forward in AI-assisted development, and the co-authored-by attribution feature reflects the broader conversation our industry is having about transparency in AI-generated content.

Whether you choose to keep the attribution for transparency or disable it for cleaner commits, the important thing is making a conscious decision that aligns with your team's values and requirements. Both approaches are valid—what matters is consistency and clear communication within your team.

As you integrate Claude Code into your deployment workflows with DeployHQ, consider establishing clear guidelines about AI tool usage and attribution. This ensures everyone on your team knows what to expect and maintains the quality standards your projects require.

Frequently Asked Questions

Does disabling the co-authored-by setting affect how Claude Code works?

No, disabling the attribution settings only affects what appears in your commit messages. Claude Code's functionality remains exactly the same—it will still analyse your code, generate commits, handle merge conflicts, and perform all other Git operations. The only difference is whether attribution lines are included in the commit messages.

Can I enable attribution for some projects and disable it for others?

Yes. Claude Code supports hierarchical settings, so you can configure different behaviours per project. Use .claude/settings.json in your project directory for project-specific settings that override your global user settings in ~/.claude/settings.json. This is useful when you want attribution on open source contributions but not on internal company projects.

Will GitHub show Claude as a contributor to my repository?

When the co-authored-by attribution is enabled, GitHub recognises the Co-Authored-By trailer and displays Claude in the co-authors list for individual commits. However, Claude won't appear in the repository's main contributors list unless commits are authored directly by Claude (which requires additional configuration using Git environment variables).

This varies by jurisdiction and context. The European Union's AI Act includes transparency provisions, and some organisations have internal policies requiring disclosure. For most individual developers and private projects, there's no legal requirement, but it's worth checking your organisation's policies and any applicable regulations in your region.

The setting doesn't seem to work—Claude still adds attribution. What's wrong?

This is a known issue that some users have reported. Claude Code sometimes adds attribution through its Bash tool even when settings are configured to disable it. As a workaround, you can add explicit instructions to your project's CLAUDE.md file stating not to include attribution, or you can use a Git hook to strip attribution lines from commits automatically.

Should I disclose AI usage in pull request descriptions even if I disable commit attribution?

This depends on your team's policies and the project you're contributing to. Some open source projects explicitly request AI disclosure in PRs (like Ghostty), while others don't mention it. When in doubt, being transparent about your tools and workflow is generally appreciated by maintainers and helps set appropriate expectations for code review.

Can I customise what the attribution message says?

The default attribution format is set by Claude Code and cannot be directly customised through settings. However, you can use Git hooks or include specific instructions in your CLAUDE.md file to guide how Claude formats commit messages. Some developers configure Claude to set itself as the full commit author (not just co-author) using environment variables in their settings.

This is a complex legal area that's still evolving. Generally, copyright for AI-assisted code depends on the level of human creative input and direction. The co-authored-by attribution doesn't transfer any copyright to Claude or Anthropic—it's purely informational. For specific legal advice about intellectual property and AI-generated code, consult with a qualified legal professional.

How do other AI coding tools handle attribution?

Different tools take different approaches. Aider, another popular AI coding assistant, adds "(aider)" to the author name and includes the model used as a co-author. GitHub Copilot doesn't add any automatic attribution. The lack of a universal standard means teams often need to establish their own conventions for AI disclosure.

Will keeping attribution enabled slow down my workflow?

No, the attribution is added automatically when commits are created and has no performance impact. The only consideration is the extra lines in your commit messages, which some teams find useful for transparency and others find unnecessary.


Ready to streamline your deployment workflow? Learn more about how DeployHQ can automate your code deployments from Git repositories to your servers.

A little bit about the author

Facundo | CTO | DeployHQ | Continuous Delivery & Software Engineering Leadership - As CTO at DeployHQ, Facundo leads the software engineering team, driving innovation in continuous delivery. Outside of work, he enjoys cycling and nature, accompanied by Bono 🐶.