Skip to content

Function: repositoryUrl()

repositoryUrl(cwd?, format?): string | undefined

The repo’s canonical remote URL, or undefined when there is no git remote. Tries gh repo view first (host-accurate, no parsing), then normalizes git remote get-url origin. A blank, omitted, or explicitly current cwd reuses cached command probes; another resolved directory executes directly.

string

directory to resolve from (defaults to process.cwd()).

"https" | "npm"

"https" (default) yields https://host/owner/repo; "npm" yields npm’s git+https://host/owner/repo.git form (for a package.json repository.url that passes npm provenance).

string | undefined