Open a git remote's web page in your browser. Smart about SSH host aliases, and interactive when a repo has multiple remotes or push URLs.
The popular paulirish/git-open works great — until your ~/.ssh/config rewrites github.com to ssh.github.com (the common port-443 workaround), at which point it happily opens https://ssh.github.com/…. Or until your repo has a fork wired up as a second push URL, where it silently picks the wrong one.
git-xopen fixes both:
- Smart SSH resolution. Host aliases like
ssh.github.com,altssh.bitbucket.org,vs-ssh.visualstudio.com, andssh.<provider>are mapped back to the canonical web host. Self-hosted GitLab / Gitea / Azure instances are left as-is. - Multi-remote selection. When a repo has more than one remote (or a remote with multiple
url/pushurlentries),git-xopenshows an interactive picker — and you can pin a default with--set-default.
npm install -g git-xopenOr run without installing:
npx git-xopenOnce installed, Git picks up git-<subcommand> executables on PATH automatically, so you invoke it as:
git xopengit xopen [options] [remote] [branch]
Options:
-p, --print Print the URL instead of opening it
--pick Force the selection prompt (ignore saved default)
--set-default Save the chosen target as the per-repo default
--clear-default Remove the saved default for this repo
-h, --help Show this help
-v, --version Show version
Common commands:
# Open the current branch's page
git xopen
# Open a specific branch on a specific remote
git xopen origin feat/login
# Just print the URL (useful in scripts / shell pipes)
git xopen --print
# Forget the default and pick again
git xopen --pick --set-default| Provider | Branch URL shape |
|---|---|
| GitHub | /tree/<branch> |
| GitLab (hosted & self-hosted) | /tree/<branch> |
| Bitbucket Cloud | /src/<branch> |
| Azure DevOps | ?version=GB<branch> |
| Gitea / Codeberg | /src/branch/<branch> |
| sourcehut | /src/branch/<branch> |
| Unknown hosts | Falls back to /tree/<branch> |
git-xopen reads remote.<name>.url and remote.<name>.pushurl directly from git config, so it does not pick up url.<base>.insteadOf rewrites (which is what causes ssh.github.com to leak into web URLs in the first place).
It then normalises known SSH aliases:
| As seen in your SSH config | Resolved to |
|---|---|
ssh.github.com |
github.com |
ssh.gitlab.com |
gitlab.com |
altssh.bitbucket.org |
bitbucket.org |
vs-ssh.visualstudio.com |
dev.azure.com |
ssh.dev.azure.com |
dev.azure.com |
ssh.<anything-else> for a known provider |
stripped |
Self-hosted hosts (gitlab.internal.corp, git.example.com, …) are preserved verbatim.
The saved default is per-repo and lives in your local git config:
[xopen]
default = origin::github.com/OWNER/REPOInspect or edit directly:
git config --get xopen.default
git config --unset xopen.defaultnpm install
npm run typecheck
npm test
npm run build
node dist/index.js --helpMIT