(On a Mac) create the following ruby script in /usr/bin/gitlab_site
#!/usr/bin/ruby
git_remote = `git remote -v`.scan(/git@(.+?).git/)
if git_remote.is_a? Array
git_remote = git_remote[0][0]
else
fail 'No git remote detectable for current directory!'
end
remote_url = 'https://' + git_remote.gsub(/:/, '/')
`open #{remote_url}`
make it executable
chmod u+x /usr/bin/gitlab_site
You can now run
gitlab_site
in any directory containing a git repository with a remote to your Gitlab Server...
That's it - have fun!
P.S. any suggestions on improving the script are highly appreciated :-)