quarto publish gh-pages cannot bootstrap a repository with no gh-pages branch (docs say it creates one)

Đang mở
#15,221 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, github, javascript
Lĩnh vực
backend, cli

Hướng nghiên cứu

Start at the quarto publish gh-pages command’s resolveDeployment path, which the error trace locates in the bundled quarto.js, and trace how it checks for a remote gh-pages branch. Reproduce with a website project in a subdirectory and an origin that has only main; compare local and CI publishing. Done means first publish creates the branch as documented, or the error explains a working bootstrap procedure.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

documentation publishing-github
Checks
  • I have searched the existing issues and discussions, and this has not been reported.
  • I have tested with the latest stable version of Quarto.
System

Linux (x86_64), Quarto 1.10.19 stable, git 2.x, remote over HTTPS with a credential helper.

Expected

Per https://quarto.org/docs/publishing/github-pages.html ("Source Branch"):

quarto publish gh-pages automatically creates a gh-pages branch (locally and on the remote) on its first run if one does not already exist.

Actual

Running exactly that first run locally fails, and says to do the thing that just failed:

$ quarto publish gh-pages --no-prompt --no-browser
ERROR: Unable to publish to GitHub Pages (the remote origin does not have a branch named
"gh-pages". Use first `quarto publish gh-pages` locally to initialize the remote repository
for publishing.)
    at resolveDeployment (file:///opt/quarto/bin/quarto.js:173771:13)

Answering the confirmation prompt interactively (printf 'y\n' | quarto publish gh-pages --no-browser) gives the same error. The same error also aborts quarto-dev/quarto-actions/publish@v2 with target: gh-pages, so the documented CI recipe cannot bootstrap a new repository either: the job fails at the publish step and no gh-pages branch is ever created.

Repository shape that may matter
  • Git repository root: /repo, with the Quarto project in a subdirectory: /repo/05_website/_quarto.yml (project.type: website, output-dir: _site, website.site-url set to the project-page URL).
  • Branches on origin: main only. No gh-pages.
  • No _publish.yml anywhere (i.e. genuinely a first run).

So the case is: valid website project, canonical site-url configured, publishing source absent. That is precisely the case the docs say Quarto initialises.

What we did to get unblocked

Created the branch by hand once, with git plumbing so the working tree was untouched:

empty=$(git hash-object -t tree /dev/null)
commit=$(git commit-tree "$empty" -m "Initialize gh-pages branch for Quarto publishing")
git push origin "$commit:refs/heads/gh-pages"

After that, the same quarto publish gh-pages invocation (from CI) renders and deploys normally, GitHub picks the branch up and Pages reports status: built. So the failure is specific to creating the branch, not to the deployment itself.

Two asks
  1. If branch creation is conditional on something (project at the repository root? a remote helper? an interactive TTY? _publish.yml?), please document the condition; the current error message points at a step that cannot be performed, because performing it produces the same error.
  2. Otherwise, either create the branch on first run as documented, or replace the message with the three-command manual bootstrap above.

Happy to test a pre-release against this repository shape.

Ngôn ngữ chính
JavaScript
Star
6.1k
Fork
478
Merge trung bình
17 giờ 7 phút
Pull request đã merge (30 ngày)
112

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/quarto-cli

Tất cả issue của quarto-dev/quarto-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.