Skip to content

git_add with files: ["."] parameter incorrectly tracks .git/ directory files causing repository corruption #2373

@jpluto458

Description

@jpluto458

Description:
The MCP Git server has a critical bug where using the git_add tool with the files parameter set to ["."] incorrectly adds .git/ directory files to the Git index, causing severe repository corruption.

Expected Behavior:
When calling git_add with files: ["."], it should execute the equivalent of git add . which adds all files in the working directory but excludes the .git/ directory (as per Git's built-in behavior).

Actual Behavior:
The MCP server appears to be adding all files that start with "." (including .git/ files) instead of properly executing git add .. This causes Git to track its own internal files, leading to:

  • Repository corruption with hundreds of .git/ files being staged
  • Repository becoming unusable
  • Need for repository reset/restoration

Reproduction:

{
  "tool": "git_add",
  "parameters": {
    "files": ["."],
    "repo_path": "~/projects/any-project"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions