Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/command/publish/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
publishRecordIdentifier,
readAccountsPublishedTo,
} from "../../publish/common/data.ts";
import { kGhpages } from "../../publish/gh-pages/gh-pages.ts";

export async function resolveDeployment(
options: PublishOptions,
Expand Down Expand Up @@ -84,7 +85,7 @@ export async function resolveDeployment(
}
} else {
return await chooseDeployment(deployments);
}
}
} else if (deployments.length === 1) {
return deployments[0];
} else {
Expand All @@ -95,7 +96,12 @@ export async function resolveDeployment(
} else if (!options.prompt) {
// if we get this far then an existing deployment has not been chosen,
// if --no-prompt is specified then this is an error state
if (!options.prompt) {
if (providerFilter === kGhpages) {
// special case for gh-pages where no _publish.yml is required but a gh-pages branch is
throw new 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.)`,
);
} else {
throw new Error(
`No _publish.yml file available (_publish.yml specifying a destination required for non-interactive publish)`,
);
Expand Down
4 changes: 0 additions & 4 deletions src/publish/gh-pages/gh-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ 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.',
);
}
}

Expand Down