Skip to content

repo-open

Terminal window
repo-open [-p|--print] [-r|--root]
repo-open -h | --help

Opens the web page for the current repository’s origin remote in a browser (via open-url). Deep-links to the current branch when it exists on the remote — falling back to the remote’s default branch (main/master) otherwise — and to the current sub-directory when run below the repo root.

The remote URL is normalized from HTTPS and SSH/scp forms (git@host:owner/repo.git, ssh://…, https://…). The web path layout is provider-specific; the provider is resolved in order:

1. git config browse.provider (per-repo or --global override)
2. Hostname heuristic (github / gitlab / gitea / bitbucket;
codeberg → gitea)
3. Default: github-style layout

Self-hosted hosts the heuristic can’t classify (a Gitea/GitLab instance on a custom domain) need a one-time override:

git config browse.provider gitea
Flags:
--print / -p Print the resolved URL instead of opening it.
--root / -r Ignore the current sub-directory; link to the repo root.
--help / -h Show usage.
Terminal window
repo-open
repo-open --print
repo-open --root

Typo abbreviation: open-repo (expands to repo-open on space/enter).