diff --git a/news/changelog-1.4.md b/news/changelog-1.4.md index c88b9ae51ce..f3efe7a6664 100644 --- a/news/changelog-1.4.md +++ b/news/changelog-1.4.md @@ -207,6 +207,7 @@ - ([#5436](https://github.com/quarto-dev/quarto-cli/issues/5436)): Add support for publishing to Posit Cloud. - ([#5220](https://github.com/quarto-dev/quarto-cli/issues/5220)): Properly respect `output-dir` when publishin individual files in a default Quarto project +- ([#4498](https://github.com/quarto-dev/quarto-cli/issues/4498)): Better error when `quarto publish gh-pages` fails because `gh-pages` branch does not exist on `origin` remote. ## Video (and Audio) diff --git a/src/publish/gh-pages/gh-pages.ts b/src/publish/gh-pages/gh-pages.ts index 68e557d3ad8..2907ac58d4e 100644 --- a/src/publish/gh-pages/gh-pages.ts +++ b/src/publish/gh-pages/gh-pages.ts @@ -96,6 +96,10 @@ async function publishRecord( id: "gh-pages", url: ghContext.siteUrl || ghContext.originUrl, }; + } else { + throwUnableToPublish( + '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.', + ); } }