A while ago, I created a shell script called git-url. It prints the remote origin URL of your current git-repository (or exit 1 if no git-repo is found). If the URL is in git: format, it is converted to http: format.

Why would one write this? Because of open `git-url`.

This will open the GitHub- or BitBucket-repository in your favorite browser. I use it all the time!

Above works on macOS. Windows uses start instead of open, but I don’t know how it works with Windows Subsystem for Linux.

Updated 2019-12-04: you now can add a SHA1 hash to go directly to that commit in the browser (GitHub and BitBucket) like open `git-url 7593e1a`, which opens this link).