[BUG] Failed to clone marketplace repository for both HTTPs and SSH

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 5 comments · opened Dec 10, 2025 · closed Aug 19, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

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

What's Wrong?

Our private marketplace already installed in Claude Code, it is hosted as github repo in our organization.
Since latest version, when I try to update or add the marketplace, we encounter an issue of authentication failure for both SSH and HTTPs although by gh cli or git cli it works.

What Should Happen?

Claude should update the marketplace

Error Messages/Logs

✘ Failed to add marketplace: Failed to clone marketplace repository: SSH authentication failed. Please ensure your SSH keys are configured for GitHub, or use an HTTPS URL instead.

Original error: Cloning into '/Users/user/.claude/plugins/marketplaces/our-marketplace'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Failed to add marketplace: Failed to clone marketplace repository: HTTPS authentication failed. You may need to configure credentials, or use an SSH URL for GitHub repositories.

Original error: Cloning into '/Users/user/.claude/plugins/marketplaces/temp_1765372792604'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Steps to Reproduce

Given a marketplace in private repo of the org
Add marketplace to the Claude Code

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.62

Claude Code Version

2.0.64

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

5 Comments

cmeyertons · 8 months ago

same here. locking myself into 2.0.62 removes the error

jamestelfer · 8 months ago

Ref: https://github.com/anthropics/claude-code/issues/13798#issuecomment-3672939271

Claude is sending some odd arguments to Git that will break other environments.

jdsumsion · 7 months ago

Workaround for Git Authentication Issues

claude plugin marketplace add fails with HTTPS authentication even when git credential helpers are correctly configured. Root cause: Claude's internal git invocation bypasses credential helpers entirely.

Solution

Direct git clone + manual registration bypasses the broken marketplace add command:

Easy install script - succeeds where Claude Code fails

install.sh

#!/bin/bash
set -e

echo "Installing marketplace..."

# Check if claude is available
if ! command -v claude &> /dev/null; then
    echo ""
    echo "Claude Code CLI is not installed."
    echo ""
    echo "To install Claude Code:"
    echo "  npm install -g @anthropic-ai/claude-code"
    echo ""
    exit 1
fi

# Check SSH authentication
check_ssh_auth() {
    ssh -T git@github.com 2>&1 | grep -q "successfully authenticated"
}

# Check HTTPS authentication (non-interactive)
check_https_auth() {
    GIT_TERMINAL_PROMPT=0 git ls-remote https://github.com/my-org/my-marketplace.git &> /dev/null
}

# Determine URL based on authentication methods
REPO_URL=""

# Step 1: Try SSH authentication
if check_ssh_auth; then
    REPO_URL="git@github.com:my-org/my-marketplace.git"
# Step 2: Try HTTPS authentication
elif check_https_auth; then
    REPO_URL="https://github.com/my-org/my-marketplace.git"
else
    # No authentication method available
    echo ""
    echo "Cannot authenticate with GitHub."
    echo ""
    if ! command -v gh &> /dev/null; then
        echo "Install GitHub CLI and authenticate:"
        echo "  https://github.com/cli/cli#installation"
        echo "  gh auth login"
    else
        echo "Authenticate with GitHub CLI:"
        echo "  gh auth login"
    fi
    echo ""
    exit 1
fi

# Clone or update marketplace directory
MARKETPLACE_DIR="$HOME/.claude/plugins/marketplaces/my-marketplace"
if [ -d "$MARKETPLACE_DIR/.git" ]; then
    echo "Updating existing marketplace..."
    cd "$MARKETPLACE_DIR" && git pull
else
    echo "Installing marketplace from $REPO_URL..."
    mkdir -p "$HOME/.claude/plugins/marketplaces"
    git clone --depth 1 "$REPO_URL" "$MARKETPLACE_DIR"
fi

# Register marketplace in known_marketplaces.json
KNOWN_MARKETPLACES="$HOME/.claude/plugins/known_marketplaces.json"
mkdir -p "$(dirname "$KNOWN_MARKETPLACES")"

if [ ! -f "$KNOWN_MARKETPLACES" ]; then
    # Create new file
    cat > "$KNOWN_MARKETPLACES" << EOF
{
  "my-marketplace": {
    "source": {
      "source": "git",
      "url": "$REPO_URL"
    },
    "installLocation": "$MARKETPLACE_DIR",
    "lastUpdated": "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")"
  }
}
EOF
    echo "Marketplace registered successfully."
else
    # File exists - splice in entry if not already present
    PYTHON_CMD=""
    if command -v python3 &> /dev/null; then
        PYTHON_CMD="python3"
    elif command -v python &> /dev/null; then
        PYTHON_CMD="python"
    fi

    if [ -n "$PYTHON_CMD" ]; then
        $PYTHON_CMD << EOF
import json
import sys
from datetime import datetime

known_marketplaces_file = "${KNOWN_MARKETPLACES}"
repo_url = "${REPO_URL}"
marketplace_dir = "${MARKETPLACE_DIR}"

try:
    with open(known_marketplaces_file, 'r') as f:
        marketplaces = json.load(f)

    if "my-marketplace" not in marketplaces:
        marketplaces["my-marketplace"] = {
            "source": {
                "source": "git",
                "url": repo_url
            },
            "installLocation": marketplace_dir,
            "lastUpdated": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.000Z")
        }

        with open(known_marketplaces_file, 'w') as f:
            json.dump(marketplaces, f, indent=2)
            f.write('\n')

        print("Marketplace registered successfully.")
    else:
        print("Marketplace already registered.")
except Exception as e:
    print(f"Error updating known_marketplaces.json: {e}", file=sys.stderr)
    sys.exit(1)
EOF
    else
        echo "Warning: python not available to update known_marketplaces.json"
    fi
fi

# Pre-install essential plugins
echo "Installing essential plugins..."
claude plugin install plugin1
claude plugin install plugin2
claude plugin install marketplace-refresh

echo ""
echo "Done! Marketplace installed."
echo ""

Auto-refresh plugin - keeps marketplace up-to-date without manual git pull:

plugins/marketplace-refresh/hooks/marketplace-refresh-startup.sh

#!/bin/bash
set -e

MARKETPLACE_DIR="$HOME/.claude/plugins/marketplaces/my-marketplace"

if [ -d "$MARKETPLACE_DIR/.git" ]; then
  cd "$MARKETPLACE_DIR"

 # Capture current commit before pull
  OLD_SHA=$(git rev-parse HEAD)

  # Try to pull latest updates
  if git pull --quiet 2>/dev/null; then
    # Success - check if anything was updated
    NEW_SHA=$(git rev-parse HEAD)
    if [ "$OLD_SHA" != "$NEW_SHA" ]; then
      COMMIT_SHA=$(git rev-parse --short HEAD)
      COMMIT_MSG=$(git log -1 --pretty=format:%s | cut -c1-35)
      echo "{\"systemMessage\": \"🔄 cc-plugins marketplace updated ($COMMIT_SHA: $COMMIT_MSG...)\"}"
    fi
  else
    # Pull failed
    echo '{"systemMessage": "Marketplace update failed.\n  You may need to manually run: cd ~/.claude/plugins/marketplaces/my-marketplace && git pull"}'
  fi
fi

plugins/marketplace-refresh/hooks/hooks.json:

{
  "description": "Pull latest marketplace updates on session start",
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup",
        "hooks": [
          {
            "type": "command",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/marketplace-refresh-startup.sh\""
          }
        ]
      }
    ]
  }
}

Benefits

  • Works with standard git authentication (SSH keys, gh CLI, credential helpers)
  • Automatic updates via SessionStart hook
  • Silent when already up-to-date
  • Shows commit info when updates succeed
  • Clear error messages with recovery instructions

This workaround has been tested and works reliably where claude plugin marketplace add fails.

jdsumsion · 7 months ago

I'm no longer seeing failures with plugin marketplace add with properly-configured gh CLI and https://github.com/org/my-private-marketplace.git, looks like the underlying HTTPS issue got fixed here #13553

bcherny collaborator · 11 days ago

Reproduced your exact failure on 2.0.64 (Linux): with a git credential helper configured, claude plugin marketplace add <private repo> failed with could not read Username for 'https://github.com': terminal prompts disabled, and the helper was never invoked — even though plain git clone of the same URL used it fine, matching your "works with git/gh CLI" observation.

This was a regression in 2.0.63/2.0.64: a change meant to stop marketplace git operations from stealing the terminal with interactive prompts also disabled git credential helpers entirely, breaking authentication to private marketplace repos over both HTTPS and SSH.

It was fixed in a recent release (changelog) — your existing auth setup (gh auth login, keychain, git-credential-store) is used again for marketplace add/update. I verified on 2.1.233 that the credential helper is invoked and authentication works. One note: SSH clones are still non-interactive by design, so SSH keys need to be available via ssh-agent rather than a passphrase prompt.

Closing as fixed — please update (claude update) and reply to reopen if you still hit this on the latest version.

🤖 Generated with Claude Code