Skip to content

Worktree cleanup problem with gh-pages publishing when wrong git setup iniially #14046

@cderv

Description

@cderv

I don't know if I should rather open a new issue, but I just had this same bug recently, and the solution mentioned here fixed it. I'm using quarto v1.8.27 on Linux (Ubuntu). Please tell me if you would prefer a new issue.

To give more context about the way it happened, I am using quarto publish gh-pages --no-prompt. The first time, I had an error related to setting user.name and user.email for git, and also this error from quarto (which I did not see) (sorry my git is in French):

Depuis github.com:alexandre-bry/MSc_Thesis-Report
 * branch            gh-pages   -> FETCH_HEAD
Rendering for publish:

[ 1/17] weekly_notes/2026_02_02.qmd
...
[17/17] reports/index.qmd

Préparation de l'arbre de travail (nouvelle branche 'gh-pages')
la branche 'gh-pages' est paramétrée pour suivre 'origin/gh-pages'.
HEAD est maintenant à 54a3240 Built site for gh-pages
Identité d'auteur inconnue

*** Veuillez me dire qui vous êtes.

Lancez

  git config --global user.email "Vous@exemple.com"
  git config --global user.name "Votre Nom"

pour régler l'identité par défaut de votre compte.
Éliminez --global pour ne faire les réglages que dans ce dépôt.

fatal: impossible de détecter automatiquement l'adresse ('ABry@DEL2202P108.(none)' trouvé)
fatal: '.quarto/quarto-publish-worktree-cfda07ef88e58d75' contient des fichiers modifiés ou non-suivis, utilisez --force pour le supprimer

There the command failed by itself (because I didn't set up git properly beforehand), and I didn't CTRL + C the program.
So I set the user.name and user.email, and then I ran the same command again, and got this:

Depuis github.com:alexandre-bry/MSc_Thesis-Report
 * branch            gh-pages   -> FETCH_HEAD
Rendering for publish:

[ 1/17] weekly_notes/2026_02_02.qmd
...
[17/17] reports/index.qmd

fatal: '/home/ABry/Documents/MSc_Thesis/MSc_Thesis-Report/.quarto/quarto-publish-worktree-cfda07ef88e58d75' contient des fichiers modifiés ou non-suivis, utilisez --force pour le supprimer
fatal: 'gh-pages' is already used by worktree at '/home/ABry/Documents/MSc_Thesis/MSc_Thesis-Report/.quarto/quarto-publish-worktree-cfda07ef88e58d75'
ERROR: Error executing 'git': Failed to spawn '/usr/bin/git': No such cwd '/home/ABry/Documents/MSc_Thesis/MSc_Thesis-Report/.quarto/quarto-publish-worktree-888a6321579d83c2'

Stack trace:
    at execProcess (file:///opt/quarto/bin/quarto.js:7098:11)
    at withWorktree (file:///opt/quarto/bin/quarto.js:155991:9)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async Object.publish2 [as publish] (file:///opt/quarto/bin/quarto.js:155836:3)
    at async publishSite (file:///opt/quarto/bin/quarto.js:159757:38)
    at async publish7 (file:///opt/quarto/bin/quarto.js:160093:58)
    at async doPublish (file:///opt/quarto/bin/quarto.js:160040:7)
    at async publishAction (file:///opt/quarto/bin/quarto.js:160059:5)
    at async _Command.actionHandler (file:///opt/quarto/bin/quarto.js:160018:9)
    at async _Command.execute (file:///opt/quarto/bin/quarto.js:10978:7)

There I was a bit confused so I just deleted the whole .quarto folder, hoping that it would fix it. But this only made the message disappear:

Depuis github.com:alexandre-bry/MSc_Thesis-Report
 * branch            gh-pages   -> FETCH_HEAD
Rendering for publish:

[ 1/17] weekly_notes/2026_02_02.qmd
...
[17/17] reports/index.qmd

fatal: 'gh-pages' is already used by worktree at '/home/ABry/Documents/MSc_Thesis/MSc_Thesis-Report/.quarto/quarto-publish-worktree-cfda07ef88e58d75'
ERROR: Error executing 'git': Failed to spawn '/usr/bin/git': No such cwd '/home/ABry/Documents/MSc_Thesis/MSc_Thesis-Report/.quarto/quarto-publish-worktree-18fe017e98427796'

Stack trace:
    at execProcess (file:///opt/quarto/bin/quarto.js:7098:11)
    at withWorktree (file:///opt/quarto/bin/quarto.js:155991:9)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async Object.publish2 [as publish] (file:///opt/quarto/bin/quarto.js:155836:3)
    at async publishSite (file:///opt/quarto/bin/quarto.js:159757:38)
    at async publish7 (file:///opt/quarto/bin/quarto.js:160093:58)
    at async doPublish (file:///opt/quarto/bin/quarto.js:160040:7)
    at async publishAction (file:///opt/quarto/bin/quarto.js:160059:5)
    at async _Command.actionHandler (file:///opt/quarto/bin/quarto.js:160018:9)
    at async _Command.execute (file:///opt/quarto/bin/quarto.js:10978:7)

Using the tips from this issue I managed to fix it with git worktree remove quarto-publish-worktree-cfda07ef88e58d75.

Originally posted by @alexandre-bry in #9929

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions