Skip to content

refactor(core): git uses the configured credential helper #6653

Closed

Description

@dan-petty

Problem

A git child of devops-cli gets its GitHub credential in three different ways:

  • _github_pin (src/devops_cli/core/process.py) gives GH_TOKEN to each git child that reaches a remote.
  • Some callers add -c credential.https://github.com.helper=… (CONST_GIT_GITHUB_CREDENTIAL_CONFIG: infra/repo_tree.py, k8s/argocd_overrides.py).
  • Since fix(repos): Give git children the session credential #6479, the process runner inserts the same two -c values into the argument list of each network git call (git_credential_args).

The second and third ways exist only because build_subprocess_env drops the ambient GIT_CONFIG_COUNT, GIT_CONFIG_KEY_n and GIT_CONFIG_VALUE_n. The devcontainer sets the GitHub credential helper through these variables (.devcontainer/image/devcontainer.json), so git does not find it. A probe in the devcontainer showed that a git child gets none of the 9 GIT_CONFIG_* keys of the shell. The runner image sets the same helper in the system config, so the Jobs do not need the variables.

Change

  • On the person path (devops-cli does not act as the GitHub App), build_subprocess_env passes the ambient GIT_CONFIG_COUNT, GIT_CONFIG_KEY_n and GIT_CONFIG_VALUE_n to git children, as a shell does.
  • When devops-cli acts as the GitHub App (runner Jobs and the Service), it passes none of them. Until feat(roadmap): add the three-container runner Job, policy and log reads #3700, a process that the agent shell starts could otherwise give agent-set values to a git child that holds the token.
  • A caller still cannot set a code-loading GIT_* key.
  • Delete git_credential_args and its argument rewrite (fix(repos): Give git children the session credential #6479), and the per-call CONST_GIT_GITHUB_CREDENTIAL_CONFIG values. Keep the read of origin before the destructive step of worktrees add (PreReadOrigin).

Acceptance criteria

  • In the devcontainer, devops repos worktrees add on a private repository reads origin with the configured helper, with no -c value from devops-cli (fix(repos): worktrees add has no credential for a private repo #6340).
  • In App mode, a GIT_CONFIG_* value in the environment does not reach a git child.
  • No code in src/ inserts credential -c values into a git argument list.

Decision

The owner approved this change on 2026-11-21, after an audit of the git use of devops-cli ("Proceed as recommended").

Related

Source

Source: #6340

Activity

  1. added
    type/refactor
    source/agent
    status/new
    value/medium
    effort/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
    • Scope: none. The title has the scope core, and .github/labels.yml declares no scope/core label. Add the label to the file to give the scope to this item.
    • Related: fix(core): give the GitHub token only to the calls that need it #5265, which asks for a different change. Both touch how credentials reach git children in build_subprocess_env, but #5265 scopes which calls get the token while this candidate changes the passing mechanism from -c args to ambient GIT_CONFIG_* vars.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 21, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 21, 2026
  5. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-21 19:37 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions