GitHub/CLI/Q/Is there any way with the gh cli to open the github pages site associated with a given repo, something like gh repo view --web, but for the github page?
Properties
- logseq-entity
- Logseq/Entity/Question
- see-also
- GitHub/Pages, GitHub/CLI/gh/browse
Is there any way with the gh cli to open the github pages site associated with a given repo, something like
gh repo view --web, but for the github page?AI Answer
- AI/Response
- Short answer: No built-in command exists, but you can get the Pages URL via
gh apiand pipe it toopen(macOS) orxdg-open(Linux). gh browsehas flags like--wiki,--settings, and--releasesbut no--pagesflag.- The GitHub Pages API endpoint returns a
html_urlfield for enabled Pages sites: - If the repo does not have GitHub Pages enabled, the API returns a 404 error.
- If the site uses a custom domain,
html_urlreturns that custom domain rather than<owner>.github.io/<repo>. - A shell alias to wrap this: