anthropics / anthropics/claude-code

[BUG] Scheduled session git clone fails with 401 — proxy git credential auto-injection (gitConfigInjection) not working

Open
#94,906 0 comments 0 reactions 0 assignees View on GitHub
area:auth area:routines bug platform:web
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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 have a daily scheduled Routine (Claude Code on the web) that needs to git clone a private GitHub repository (otsugu109-rgb/my-projects) at the start of each run.

Every run fails at the initial clone/checkout step with:

fatal: could not read Username for 'https://github.com': terminal prompts disabled

Underlying HTTP check confirms 401 Unauthorized from https://github.com//.git/info/refs?service=git-upload-pack (realm="ccr-gitengine"), meaning no auth credentials are being attached to the git request.

I confirmed:

The repository is correctly set to Private on GitHub (expected).
The Claude GitHub App installation has "Repository access: All repositories" approved (confirmed via github.com/settings/installations).
This happened both in an existing session and in a fresh manually-triggered Routine run — same failure signature in both.
The agent proxy status endpoint reportedly shows gitConfigInjection: true, indicating the environment believes automatic git credential injection is active, but no Authorization header is actually reaching GitHub (still 401 without any credentials).

This looks like a bug in the proxy's automatic git credential injection for scheduled/Routine sessions, not a repo permission or GitHub App configuration issue on my end.

Could you please look into why gitConfigInjection reports active but git requests to github.com are not actually authenticated in this environment?

### What Should Happen?

The scheduled Claude Code Routine session should be able to `git clone` / `git fetch` the linked private GitHub repository at the start of the run, using the GitHub App authorization already granted for this account.

### Error Messages/Logs

```shell
$ git clone https://github.com/otsugu109-rgb/my-projects.git
Cloning into 'my-projects'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Direct check (no credentials):
$ curl -sS -o /dev/null -w "%{http_code}\n" "https://github.com/otsugu109-rgb/my-projects.git/info/refs?service=git-upload-pack"
401
```

### Steps to Reproduce

1. Set up a daily scheduled Routine on Claude Code on the web (claude.ai/code), pointed at a private GitHub repository the account's GitHub App is authorized for (Repository access: All repositories).
2. Have the Routine's first step run `git clone` (or `git fetch`) on that repository over HTTPS, inside the managed session/container.
3. Observe the clone fails immediately with "could not read Username for 'https://github.com': terminal prompts disabled" (git exit code 128).
4. Confirmed the repo's GitHub App installation permissions are correctly set (Repository access: All repositories, verified on github.com/settings/installations).
5. Reproduced identically both in an existing session and in a freshly, manually-triggered run of the same Routine (new container), ruling out a stale-session credential issue.

### Claude Model

None

### Is this a regression?

No, this never worked

### Last Working Version

_No response_

### Claude Code Version

N/A — this is a Claude Code on the web scheduled Routine session, not a local CLI installation.

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

Windows Terminal

### Additional Information

This occurs specifically in scheduled/Routine sessions on Claude Code on the web (claude.ai/code), running in a managed cloud container behind an internal egress proxy.

The proxy's own diagnostic status endpoint reportedly indicates gitConfigInjection: true (i.e., it believes it is automatically injecting git credentials for GitHub), but the actual git HTTPS requests to github.com reach GitHub with no Authorization header at all, resulting in a 401 from GitHub itself (not the proxy).

This is not a repository permission issue — the GitHub App installation for this account has "Repository access: All repositories" approved, confirmed directly on github.com/settings/installations.

This appears to be a bug in the proxy's automatic git credential injection for scheduled Routine sessions specifically, since interactively-started sessions may behave differently.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure in a scheduled Routine session using the reported git clone and curl info/refs checks. Compare the proxy diagnostic status endpoint's gitConfigInjection value with the actual GitHub request path and authentication behavior. Done means private-repository clone or fetch succeeds with the authorized GitHub App credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.