Checkout Pull Request in Worktree fails for PRs from forks ("Failed to execute git")
Los mantenedores suelen responder en 1 día
@alexr00 ya está trabajando en esto.
Desde el 24/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Bug
"Checkout Pull Request in Worktree" fails with a generic Failed to create worktree: Failed to execute git error whenever the pull request comes from a fork.
Root cause
checkoutPRInWorktree in src/github/worktree.ts always fetches the PR's head branch from the base repo's remote:
const remoteName = pullRequestModel.remote.remoteName;
...
await repositoryToUse.fetch({ remote: remoteName, ref: branchName });
pullRequestModel.remote is the remote for the repository the PR was opened against (typically origin). For a PR opened from a fork, the head branch only exists on the fork's remote/clone URL, not on origin, so the fetch fails with something like:
fatal: couldn't find remote ref <branch-name>
That underlying git error isn't surfaced — it's swallowed into the generic "Failed to execute git" message shown to the user, which makes the bug very hard to diagnose without extension logs.
Note the extension's regular (non-worktree) checkout path already handles this correctly: PullRequestGitHelper.fetchAndCheckout detects isFork (pull.head.repositoryCloneUrl.owner !== pull.base.repositoryCloneUrl.owner) and, when true, calls checkoutFromFork, which creates (or reuses) a remote pointing at the fork's clone URL before fetching. The worktree checkout path bypasses all of this.
Repro steps
- Open a repo where you have
originpointing at the upstream repository. - Open a pull request from a fork (i.e.
head.repo.owner != base.repo.owner) in the Pull Requests view. - Use "Checkout Pull Request in Worktree".
- Observe the notification:
Failed to create worktree: Failed to execute git. - In the Git output channel /
Git.log, the actual command run is:> git fetch origin <fork-branch-name> fatal: couldn't find remote ref <fork-branch-name>
Expected behavior
Worktree checkout should succeed for fork PRs the same way regular checkout does, by fetching from a remote associated with the fork (creating one if necessary) instead of always using the base repo's remote.
Environment
- GitHub Pull Requests extension (recent version, confirmed via extension logs on 2026-09-24)
- VS Code Server (remote/SSH), Linux
Fix
I have a small fix ready and will open a PR shortly that mirrors the existing fork-detection logic from PullRequestGitHelper.fetchAndCheckout/checkoutFromFork inside checkoutPRInWorktree.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.6k
- Forks
- 796
- Merge medio
- 1 d 26 min
- PR fusionados (30 d)
- 35
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-pull-request-github
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/vscode-pull-request-github#8953 ·
Los mantenedores suelen responder en 1 día
-
Issue 3 — DocumentationAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/vscode-pull-request-github#8792 ·
Los mantenedores suelen responder en 1 día
-
BachalorAbierto~spam
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
microsoft/vscode-pull-request-github#8986 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
doesnt accept ghe signinPosiblemente ocupada @TylerLeonhardt la tomó hace 5 días. Abierto
microsoft/vscode-pull-request-github#8982 · 1 comentario · 2 reacciones · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Opening a submodule bump in the PR changes view fails: "Unable to read file ... that is actually a directory"Posiblemente ocupada @alexr00 la tomó hace 5 días. Abierto
microsoft/vscode-pull-request-github#8981 · 1 reacción · 2 asignados ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/vscode-pull-request-github
Issues similares
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
inu-appcenter/memorIN-frontend#106 ·
Los mantenedores suelen responder en 1 día
-
kind/bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 7 días
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
fix: CopyFilters ignores tabAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
CSCfi/sd-search-ui#145 ·
Los mantenedores suelen responder en 1 día
-
Add: Cbeebies pl SDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día