desktop/desktop

Non-LFS Git filters trigger Git LFS initialization prompt

Open

#22,181 建立於 2026年5月24日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (18,758 star) (9,945 fork)batch import
bughelp wanted

描述

The problem

GitHub Desktop shows the "Initialize Git LFS" prompt for a repository that has Git attribute rules for a non-LFS Git filter.

In the affected repository, .gitattributes contains entries such as:

*.png filter=annex

The repository does not use Git LFS tracking rules. Running git lfs track --json reports the pattern as present, but with tracked: false, meaning Git LFS treats it as an excluded/non-LFS pattern rather than an actual LFS-tracked pattern.

GitHub Desktop appears to treat any output from git lfs track as evidence that the repository uses Git LFS. This causes Desktop to prompt users to initialize Git LFS even when there are no actual LFS-tracked patterns.

Release version

3.5.10

Operating system

macOS 26.4.1

Steps to reproduce the behavior

  1. Create or open a Git repository.

  2. Add a .gitattributes entry for a non-LFS Git filter, for example:

    *.png filter=annex
    
  3. Open or add the repository in GitHub Desktop.

  4. Observe the "Initialize Git LFS" prompt.

For comparison, running git lfs track --json in the repository reports patterns with tracked: false, not actual LFS-tracked rules.

Log files

Relevant command output from the affected repository:

{
  "patterns": [
    {
      "pattern": "*.[pp][nn][gg]",
      "source": ".gitattributes",
      "lockable": false,
      "tracked": false
    }
  ]
}

In the local reproduction, GitHub Desktop production logs showed Executing isUsingLFS: git lfs track before the prompt appeared.

Screenshots

N/A

Additional context

A small patch has been prepared that changes GitHub Desktop's LFS detection to parse git lfs track --json and only treat the repository as using Git LFS when at least one pattern has tracked: true.

The patched dev build was validated against a repository with non-LFS filter=annex attributes and did not show the Git LFS initialization prompt.

貢獻者指南