Skip to content

[Bug]: Push sends a tracked branch to origin and ignores the configured push remote #35028

Closed as not planned

Description

@only21mil

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Clone a repository as origin, add a second remote fork, and run git config remote.pushDefault fork.
  2. Check out topic tracking origin/topic and commit a change. Plain git push would now send it to fork.
  3. Open the folder as a project in T3 Code and choose Push from the Git action options.

Expected behavior

The commit goes to fork, as plain git push does with this setting.

Actual behavior

The panel says "Pushed to origin/topic" and the commit lands in origin. The fork's topic does not get it. The same happens when I set branch.topic.pushRemote fork instead of remote.pushDefault.

Impact

Major degradation or frequent failure

Version or commit

main, commit b68aedf

Environment

Server built from source on macOS, web client in Chromium on Linux. Both remotes were local bare repositories.

Logs or stack traces

In the clone, after two Pushes from T3 Code (the first with remote.pushDefault fork, the second with branch.topic.pushRemote fork instead):

$ git config --get-regexp push
branch.topic.pushremote fork
$ git remote -v
fork	../personal-fork.git (fetch)
fork	../personal-fork.git (push)
origin	../source.git (fetch)
origin	../source.git (push)
$ git branch -vv
  main  204c732 [origin/main] Initial commit
* topic 22f6d1f [origin/topic] Add another line to notes
$ git log --oneline -3 topic
22f6d1f Add another line to notes
af22a31 Add a line to notes
05e8dd4 Start topic
$ git -C ../source.git log --oneline -3 topic
22f6d1f Add another line to notes
af22a31 Add a line to notes
05e8dd4 Start topic
$ git -C ../personal-fork.git log --oneline -3 topic
05e8dd4 Start topic
204c732 Initial commit

Screenshots, recordings, or supporting files

main b68aedf: after Push with the push remote set to fork, the panel says "Pushed to origin/topic"
main b68aedf: after Push with the push remote set to fork, the panel says "Pushed to origin/topic"

Workaround

Push from a terminal with git push.

A fix is in #24047.

Activity

  1. juliusmarminge commented on Nov 12, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    In progress: the worktree at origin/main ee90bdc is still checking out. I have not run the reproduction yet.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  2. only21mil commented on Nov 12, 2026

    @only21mil
    ContributorAuthor

    Note

    🤖 Opus 5.5 replying on behalf of Victor.

    It still happens for me on main ee90bdc940, on Linux: server built from that commit, web client in Chromium. The step that matters is that topic tracks origin/topic (git push -u origin topic). A branch that tracks nothing goes to the fork and looks fine.

    Exact steps, in a new empty folder, with no network remote:

    git init --bare -b main source.git
    git init --bare -b main personal-fork.git
    git clone source.git sample-push
    cd sample-push
    git config user.name "Test User"
    git config user.email "test@example.com"
    git symbolic-ref HEAD refs/heads/main
    echo "first line" > notes.txt
    git add notes.txt
    git commit -m "Initial commit"
    git push -u origin main
    git switch -c topic
    echo "topic line" >> notes.txt
    git commit -am "Start topic"
    git push -u origin topic
    git remote set-url origin ../source.git
    git remote add fork ../personal-fork.git
    git push fork main topic
    git fetch fork
    git config remote.pushDefault fork
    echo "a line" >> notes.txt
    git commit -am "Add a line to notes"
    git push --dry-run

    The last command prints To ../personal-fork.git, so plain git push would go to the fork.

    In T3 Code: Add project, Local folder, the sample-push folder. In Thread details, section Version Control, click Git action options (the chevron beside the Git button), then Push. The panel says "Pushed to origin/topic".

    git -C ../source.git log --oneline -1 topic
    git -C ../personal-fork.git log --oneline -1 topic

    source.git shows "Add a line to notes" and the fork still shows "Start topic". With git config branch.topic.pushRemote fork in place of remote.pushDefault, in a fresh folder, the result is the same.

    The same check as a scenario file for scripts/scenarios/

    Saved as scripts/scenarios/push-goes-to-push-remote.e2e.ts and run with pnpm exec e2e run scenarios/push-goes-to-push-remote.e2e.ts from scripts, it fails on ee90bdc940 at the fork assertion.

    import { execFileSync } from "node:child_process";
    import * as NodePath from "node:path";
    
    import { expect } from "e2e";
    
    import { test, WEB } from "./t3.ts";
    
    test("Push sends a tracked branch to the configured push remote", WEB, async ({ t3, screen, app }) => {
      const clone = await t3.project("sample-push", { "notes.txt": "first line\n" });
      const parent = NodePath.dirname(clone);
      const git = (cwd: string, ...args: Array<string>) =>
        execFileSync(
          "git",
          ["-c", "user.name=Scenario", "-c", "user.email=scenario@example.invalid", ...args],
          { cwd, encoding: "utf8" },
        ).trim();
    
      git(parent, "init", "--quiet", "--bare", "--initial-branch=main", "source.git");
      git(parent, "init", "--quiet", "--bare", "--initial-branch=main", "personal-fork.git");
      git(clone, "remote", "add", "origin", "../source.git");
      git(clone, "remote", "add", "fork", "../personal-fork.git");
      git(clone, "push", "--quiet", "-u", "origin", "main");
      git(clone, "switch", "--quiet", "-c", "topic");
      git(clone, "commit", "--quiet", "--allow-empty", "-m", "Start topic");
      git(clone, "push", "--quiet", "-u", "origin", "topic");
      git(clone, "push", "--quiet", "fork", "main", "topic");
      git(clone, "config", "remote.pushDefault", "fork");
      git(clone, "commit", "--quiet", "--allow-empty", "-m", "Add a line to notes");
      const head = git(clone, "rev-parse", "HEAD");
    
      await t3.open();
      await screen.getByRole("button", "Git action options").tap();
      await screen.getByRole("menuitem", "Push").tap();
      await expect(screen.getByText(/^Pushed to /)).toBeVisible();
      await app.screenshot("after-push");
    
      const tip = (repo: string) => git(NodePath.join(parent, repo), "rev-parse", "topic");
      expect(tip("personal-fork.git")).toBe(head);
      expect(tip("source.git")).not.toBe(head);
    });
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions