Skip to content

Fix manuscript rendering blocking on git remote errors#13744

Merged
cderv merged 1 commit into
mainfrom
fix/issue-10031
Dec 5, 2025
Merged

Fix manuscript rendering blocking on git remote errors#13744
cderv merged 1 commit into
mainfrom
fix/issue-10031

Conversation

@cderv

@cderv cderv commented Dec 1, 2025

Copy link
Copy Markdown
Member

When rendering manuscript projects with git origin pointing to a private repository, Quarto prompts for GitHub credentials or fails with an error:

Username for 'https://github.com': 
Password for 'https://...@github.com':

or

ERROR: There is an error while retrieving information from remote 'origin'.
 Git error: git@github.com: Permission denied (publickey).
...

This blocks renders and prevents users from working with manuscript projects that have private repositories as their git origin.

Root Cause

The manuscript project type calls gitHubContext() in filterParams() to auto-detect the manuscript-url from GitHub Pages. This function runs git ls-remote origin gh-pages, which is a network operation requiring authentication for private repos. Any failure (credentials, network, host key verification, repository not found) throws an error that blocks rendering.

Fix

Added try/catch in manuscript.ts filterParams() around the gitHubContext() call (line 371). When git operations fail:

  • Error is caught gracefully without blocking the render
  • Warning shown once per render using warnOnce(): "Unable to auto-detect manuscript URL from GitHub Pages. Set manuscript-url explicitly in your configuration if needed."
  • Full error details logged when --log-level debug is used
  • Conditional debug hint added to warning message in non-debug mode
  • Properly typed error handling for TypeScript

The fix only modifies manuscript.ts - github.ts remains unchanged so publish workflows continue to receive thrown errors as expected.

Manual Testing

Tested with manuscript-tutorial repository by changing origin to point to non-existent private repository:

cd /tmp
git clone https://github.com/cderv/manuscript-tutorial
cd manuscript-tutorial
git remote set-url origin https://github.com/cderv/private-manuscript-repo.git
quarto render

Verified:

  • ✅ Rendering completes successfully without prompting for credentials
  • ✅ Warning appears once (not repeated for every file): "WARN: Unable to auto-detect manuscript URL from GitHub Pages..."
  • ✅ Debug mode shows full error details: "Failed to auto-detect manuscript URL from GitHub: There is an error while retrieving information from remote 'origin'..."
  • ✅ Warning includes debug hint in normal mode, excludes it in debug mode
  • ✅ Output created successfully: _manuscript/index.html

Fixes #10031

Manuscript URL auto-detection from GitHub Pages now fails gracefully
when git ls-remote operations fail (credentials, network, host key, etc.)
instead of blocking renders.
@posit-snyk-bot

posit-snyk-bot commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv cderv merged commit 1595ceb into main Dec 5, 2025
51 checks passed
@cderv cderv deleted the fix/issue-10031 branch December 5, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarto ask for GitHub username and password when rendering or preview with command line.

2 participants