Syntax
Description
Therepo open command opens the current Git repository’s remote URL in your default web browser. It automatically converts SSH URLs to HTTPS format for browser compatibility.
This command must be run from within a Git repository that has an
origin remote configured.How It Works
- Retrieves the
originremote URL usinggit remote get-url origin - Converts SSH format (
[email protected]:user/repo.git) to HTTPS (https://github.com/user/repo.git) - Opens the URL using
xdg-open(Linux standard)
Examples
Open current repository
https://github.com/user/project in your browser.
Open after cloning
https://github.com/torvalds/linux in your browser.
Open from any worktree
URL Conversion
The command handles various URL formats:SSH to HTTPS
Already HTTPS
Other hosting services
Error Handling
Not in a Git repository
No origin remote
xdg-open not available
xdg-open installed (rare on modern Linux distributions).
Failed to open URL
Platform Support
The command usesxdg-open, which is the standard way to open URLs on Linux systems. It respects your default browser configuration.
On macOS or Windows, you may need to modify the
repo_open function to use open (macOS) or start (Windows) instead of xdg-open.Related Commands
- repo get - Clone a repository with remote configured
- repo goto - Navigate to a repository before opening
Common Use Cases
Quick access to pull requests
View repository issues
Share repository link
Check CI/CD status
Tips
Implementation Details
Source code:functions/open.zsh:1
The command uses a series of string transformations:
- Replace
git@withhttps://using parameter expansion - Convert the first colon after the domain to a slash using
sed: - Open the URL with
xdg-open