Skip to content

git fetch falsely reported as access/repository error when it actually succeeds (exit 0) #2211

Open

Description

@leekkk2

Summary

git fetch origin <branch> run through rtk is rewritten into git's "could not read from remote repository / please make sure you have the correct access rights and the repository exists" failure message — even though the fetch actually succeeds (exit code 0).

Running the exact same command with rtk proxy git fetch origin <branch> shows the real, successful output:

* branch <branch> -> FETCH_HEAD

with exit code 0. So this is rtk reshaping a successful fetch into a fake access/repository error, not a real git/network/permission problem.

Steps to reproduce

In any git repo that has a valid origin remote and an existing branch main:

  1. rtk git fetch origin main
    → reported as an access-rights / repository-does-not-exist failure (fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.). On a non-English locale this surfaces as the localized translation of the same message.
  2. rtk proxy git fetch origin main
    → * branch main -> FETCH_HEAD, exit code 0 (real success).

Note that other git remote operations are not affected and pass through correctly through rtk:

  • rtk git ls-remote origin — fine
  • rtk git push — fine

Only git fetch origin <branch> is misclassified.

Expected

rtk should pass git fetch through faithfully. An exit code of 0 means the fetch succeeded and should be reported as success (or summarized without inventing a failure).

Actual

A successful git fetch (exit 0) is rewritten into an "access rights / repository exists" failure, which misleads the user/agent into believing there is a permission or missing-repository problem when there is none.

Environment

  • rtk version: 0.41.0
  • OS: macOS
  • Command shape: git fetch with an explicit refspec (origin <branch>)

Suggested fix / direction

  1. Treat the git fetch exit code as the source of truth (0 = success). Do not infer failure from stderr content.
  2. git fetch normally writes its progress + ref-update summary (From <remote>, * branch <branch> -> FETCH_HEAD) to stderr as normal, expected behavior — rtk must not classify these stderr lines as an error.
  3. Do not synthesize the "correct access rights / repository exists" wording unless git itself exited non-zero with that exact error.
  4. Add git fetch to the same faithful / pass-through handling that the other git remote subcommands (ls-remote, push) already use correctly.

Activity

  1. pszymkowiak commented on Jun 2, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 93%

    Summary

    rtk rewrites successful git fetch (exit 0) into a fake access/repository error by misclassifying normal stderr progress output as failure; fix by trusting exit code over stderr content for git fetch.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. added a commit that references this issue on Jun 2, 2026
    162de79
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions