Simple bash script for opening a repository in the browser from the command line
Some things:


You don't need the function keyword to define a function.
You can combine sed commands by separating them by ;: sed 's/\.git//;s/https:\/\///;s/ssh:\/\///;s/git:\/\///;s/git@//'
This can be shortened down to a single statement: sed 's/\(\.git\|https:\/\/\|ssh:\/\/\|git:\/\/\|git@\)//'
Fortunately you can get rid of picket fences in sed by using a different separator: sed 's#\(\.git\|https://\|ssh://\|git://\|git@\)##'
I'd use getopt or getopts for option handling. Which one to use is a bit of a religious issue, but getopt supports long options (--help and the like), while getopts is more portable.
It is recommended to use upper case only for variables exported in the shell, and lower case for other variables.
This is maybe more of a personal preference, but rather than creating a function called I'd create a script with the same name and move the contents of the browse-repository function to the end of the script. That way there's no pollution of the function name space, and no need to source the script. Just put it for example at /usr/local/bin/browse-repository and run. An added advantage of this is that you don't need the function name prefixes anymore.
I'm not sure how portable open is. On my system:

$ open http://www.example.org
Couldn't get a file descriptor referring to the console


Alternatively you could use x-www-browser, but I fear that's even less portable (Debian &amp; derivatives only IIRC). I don't know if there's something more portable available.


All in all a very nice script.