claude-code - 💡(How to fix) Fix [BUG] Use SHA as marketplace ref cause git clone --branch error

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Plugin Error:

Error Messages/Logs

Code Example

❯ anthropic-agent-skills (user)
      Failed to clone marketplace repository: Cloning into '/Users/g/.claude/plugins/marketplaces/temp_1776685439892'...
      warning: Could not find remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb to clone.
      fatal: Remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb not found in upstream origin

---

❯ anthropic-agent-skills (user)
      Failed to clone marketplace repository: Cloning into '/Users/g/.claude/plugins/marketplaces/temp_1776685439892'...
      warning: Could not find remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb to clone.
      fatal: Remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb not found in upstream origin

---

{
  "strictKnownMarketplaces": [
    {
        "source": "git",
        "url": "https://github.com/anthropics/skills.git",
        "ref": "0f7c287eaf0d4fa511cb871bb55e2a7862251fbb"
    }
  ],
  "enabledPlugins": {
    "document-skills@anthropic-agent-skills": false,
    "claude-api@anthropic-agent-skills": false
  }
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

I wanted to use SHA as ref which is mentioned in the document but failed. https://code.claude.com/docs/en/settings#strictknownmarketplaces

Plugin Error:

   ❯ anthropic-agent-skills (user)
      Failed to clone marketplace repository: Cloning into '/Users/g/.claude/plugins/marketplaces/temp_1776685439892'...
      warning: Could not find remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb to clone.
      fatal: Remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb not found in upstream origin

What Should Happen?

Claude code should clone the repo and then checkout by SHA, not using git clone --branch to clone the SHA ref.

Error Messages/Logs

❯ anthropic-agent-skills (user)
      Failed to clone marketplace repository: Cloning into '/Users/g/.claude/plugins/marketplaces/temp_1776685439892'...
      warning: Could not find remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb to clone.
      fatal: Remote branch 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb not found in upstream origin

Steps to Reproduce

My managed-settings.json

{
  "strictKnownMarketplaces": [
    {
        "source": "git",
        "url": "https://github.com/anthropics/skills.git",
        "ref": "0f7c287eaf0d4fa511cb871bb55e2a7862251fbb"
    }
  ],
  "enabledPlugins": {
    "document-skills@anthropic-agent-skills": false,
    "claude-api@anthropic-agent-skills": false
  }
}

My ~/.claude/settings.json:

{
  "enabledPlugins": {
    "example-skills@anthropic-agent-skills": true
  },
  "extraKnownMarketplaces": {
    "anthropic-agent-skills": {
      "source" :  {
        "source": "git",
        "url": "https://github.com/anthropics/skills.git",
        "ref": "0f7c287eaf0d4fa511cb871bb55e2a7862251fbb"
      }
    }
  },
  "skipDangerousModePermissionPrompt": true
}

### Claude Model

None

### Is this a regression?

No, this never worked

### Last Working Version

_No response_

### Claude Code Version

2.1.114

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

iTerm2

### Additional Information

The goal of doing this is control the plugins strictly so that plugins added to marketplace in the future won't be enabled automatically.

extent analysis

TL;DR

The issue is likely due to the git clone command being used with a SHA ref as if it were a branch, instead of using the --branch option or git clone with a SHA ref.

Guidance

  • The error message suggests that the git clone command is being used with a SHA ref (0f7c287eaf0d4fa511cb871bb55e2a7862251fbb) as if it were a branch, which is causing the error.
  • To fix this, the git clone command should be used with the --branch option or with a SHA ref, like git clone <repo_url> --branch <sha_ref> or git clone <repo_url> && git checkout <sha_ref>.
  • The managed-settings.json and ~/.claude/settings.json files seem to be correctly configured, with the ref field set to the desired SHA.
  • The issue might be in the Claude Code's implementation of the git clone command, which should be modified to handle SHA refs correctly.

Example

git clone https://github.com/anthropics/skills.git && git checkout 0f7c287eaf0d4fa511cb871bb55e2a7862251fbb

Notes

  • The issue is not a regression, as it never worked before.
  • The Claude Code version is 2.1.114, which might be relevant for debugging purposes.

Recommendation

Apply workaround: Modify the Claude Code's implementation of the git clone command to handle SHA refs correctly, or use a temporary workaround like the example provided.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING