This Bash script allows you to quickly open the remote URL of a Git repository in your default web browser. It's useful for developers who frequently need to access the web interface of their Git repositories (e.g., GitHub, GitLab, Bitbucket).
Built partly with the help of Claude
- Opens the remote URL of a Git repository in your default web browser
- Works with both HTTPS and SSH remote URLs
- Can be run from any directory within a Git repository
- Allows specifying a different Git repository directory
- Option to only print the URL without opening the browser
- Git installed and accessible from the command line
- A default web browser (the script uses
xdg-open
on Linux)
- Download the script:
sudo curl -o /usr/local/bin/git-repo-opener https://raw.githubusercontent.com/clove3am/git-repo-opener/main/git-repo-opener.sh
- Make it executable:
chmod +x /usr/local/bin/git-repo-opener
Run the script from within a Git repository:
git-repo-opener
This will open the remote URL of the current Git repository in your default web browser.
-h
or--help
: Display the help message-d <path>
or--directory <path>
: Specify a different Git repository directory-p
or--print
: Only print the URL, don't open in the browser
-
Open the remote URL of the current directory's Git repository:
git-repo-opener
-
Open the remote URL of a specific Git repository:
git-repo-opener -d /path/to/your/repo
-
Only print the remote URL without opening it:
git-repo-opener -p
-
Print the remote URL of a specific repository:
git-repo-opener -d /path/to/your/repo -p
Contributions to improve the script are welcome! Please feel free to submit issues or pull requests on the project's repository.
This script is released under the MIT License. See the LICENSE file for details.