[BUG] Claude accesses git origin server on startup before any commands issued

Status Open
Reported on v2.1.19
Maintainer reply ✓ Yes — stbenjam
Activity 15 comments · opened Jan 26, 2026
💡 Likely answer: A maintainer (stbenjam, contributor) 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?

I'm using Claude Code, on an ubuntu machine. Sometimes (not always) when I run claude in a directory with a git repo, after it starts up, and shows its little > Try "write a todo list" or whatever, I get prompted for the passphrase of my SSH key to github.com - the SSH key is associated with the origin server of the current git repo I'm in.

Before anybody suggests (as Claude did) that I just cache my passphrase or some such - no, that's exactly what I don't want. I explicitly do not want claude interacting with the origin server, which is why the passphrase is there. It can do all the coding it wants locally, but deliberately has zero authZ to do anything off the box.

So, Claude appears to be doing something with the github origin server completely by itself without being prompted to do anything - as part of "orienting itself" or similar. This is not good behavior, and is the key bug to be fixed.

Interestingly, this appears to be some kind of race condition. I have a set of tests on a utility which automates running claude and when these tests are run in parallel, it prompts for the ssh passphrase almost every time. When they're run serially in a single thread, I think this never happens. When running the tool manually it certainly seems to happen more when I run multiple instances in quick succession. (The current release which starts up faster is much harder to repo than slightly older 2.0.69.)

What Should Happen?

NEVER attempt to access my github origin server without being asked to!

Error Messages/Logs

Steps to Reproduce

Set up your ~/.ssh/config like this:

Host github.com
    Hostname github.com
    user git
    IdentityFile ~/.ssh/my-github-key-with-passphrase.pem

And create an ED2215 key with a passphrase as ~/.ssh/my-github-key-with-passphrase.pem

Create a file race.sh:

#!/bin/bash

claude -p "what time is it?" &
claude -p "what time is it?" &
claude -p "what time is it?" &
claude -p "what time is it?" &
claude -p "what time is it?" &

Then run it:

$ ./race.sh
Enter passphrase for key '/home/ubuntu/.ssh/my-github-key-with-passphrase.pem':
Enter passphrase for key '/home/ubuntu/.ssh/my-github-key-with-passphrase.pem':
Enter passphrase for key '/home/ubuntu/.ssh/my-github-key-with-passphrase.pem':
Enter passphrase for key '/home/ubuntu/.ssh/my-github-key-with-passphrase.pem':
I don't have access to real-time information like the current time. You can check the time on your device or run:

```bash
date

in your terminal to see the current date and time.
I don't have access to real-time information like the current time. You can check the time on your device or run:

date

in your terminal to see the current date and time.
I don't have access to the current time. You can check the time on your system by running:

date

Or if you'd like, I can run that command for you.
I don't have access to the current time. I can only see today's date (2026-01-26) from my environment information, but not the current time.

You can check the time by running date in your terminal, or checking your system clock.
I don't have access to real-time clock information. To check the current time on your system, you can run:

date

Would you like me to run that command for you?


### Claude Model

Sonnet (default)

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.19

### Platform

AWS Bedrock

### Operating System

Ubuntu/Debian Linux

### Terminal/Shell

iTerm2

### Additional Information

_No response_

View original on GitHub ↗

12 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14485
  2. https://github.com/anthropics/claude-code/issues/16274
  3. https://github.com/anthropics/claude-code/issues/14346

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

djc · 7 months ago

I think this might be different from/broader than #14485:

I implemented the workaround in https://github.com/anthropics/claude-code/issues/14485#issuecomment-3725218624 but am still seeing Claude Code prompt for authentication. Not sure whether that's for this marketplace stuff or for "git context gathering" (as in #21108), but it's definitely a shady look.
captivus · 6 months ago

I have this same issue.

stbenjam contributor · 6 months ago

This is the same problem I reported in https://github.com/anthropics/claude-code/issues/14346 but it was closed. This is still an issue, and my workaround below is now bypassed in the latest version in my global .gitconfig:

[url "https://github.com/anthropics/"]
	insteadOf = ssh://git@github.com/anthropics/

Whenever I send the first message with Claude, I get prompted to unlock my YubiKey SSH keys, and I also see this in ps aux

ssh -T -o BatchMode=yes -o ConnectTimeout=2 -o StrictHostKeyChecking=yes git@github.com

Claude should _NEVER_ be doing anything with marketplaces using ssh to github...

stbenjam contributor · 6 months ago

Looks like the same as #16274 too.

kroleg · 5 months ago

Same happens to me on macos with claude 2.1.63. On first prompt it somehow triggers ssh key prompt (which i store in 1Password)

emonti-ltc · 5 months ago

Still an issue on claude 2.1.69 - first prompt always triggers ssh-agent for key access, regardless of what is actually being requested.

agarzola · 5 months ago

I see very similar behavior in v2.1.71 with my SSH key managed via 1Password. In my case, the only difference is that Git commands that access the remote repo appear to only run after I send my first prompt to Claude Code.

Screencast illustrating the issue:

https://github.com/user-attachments/assets/20ffe6e2-38ab-4702-bc5f-a9a4847e89b5

aldur · 5 months ago

+1. My workaround so far is to set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1.

langri-sha · 5 months ago

Another workaround: create a wrapper script that intercepts Claude Code's SSH connectivity probe and fakes a success response, passing all other SSH calls through to the real binary:

mkdir -p ~/.claude/bin

cat > ~/.claude/bin/ssh << 'EOF'
#!/usr/bin/env bash
# Intercept Claude Code's SSH connectivity probe to avoid
# 1Password / YubiKey / GPG agent prompts.

if [[ "$*" == *"-T"* && "$*" == *"BatchMode=yes"* && "$*" == *"ConnectTimeout=2"* && "$*" == *"StrictHostKeyChecking=yes"* && "$*" == *"git@github.com"* ]]; then
  echo "Hi! You've successfully authenticated, but GitHub does not provide shell access." >&2
  exit 1
fi

exec /usr/bin/ssh "$@"
EOF

chmod +x ~/.claude/bin/ssh

Then prepend it to PATH when launching Claude:

PATH="$HOME/.claude/bin:$PATH" claude

This avoids the CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 tradeoff of losing feature flags and gated commands. Claude sees a successful SSH check, 1Password/YubiKey never gets triggered, and all other SSH operations work normally.

sQu1rr · 5 months ago
DISABLE_AUTOUPDATER=1

worked for me

joshlewis · 1 month ago

This really needs to be fixed. ☹️ I'm getting these interruptions constantly.

Showing cached comments. Read the full discussion on GitHub ↗