Skip to content

Instantly share code, notes, and snippets.

@michaellihs michaellihs/
Last active Aug 29, 2015

What would you like to do?
Opens a Gitlab site for the current directory

Gitlab Helper for opening Gitlab project site of current git repository


(On a Mac) create the following ruby script in /usr/bin/gitlab_site


git_remote = `git remote -v`.scan(/git@(.+?).git/)
if git_remote.is_a? Array
  git_remote = git_remote[0][0]
  fail 'No git remote detectable for current directory!'
remote_url = 'https://' + git_remote.gsub(/:/, '/')
 `open #{remote_url}`

make it executable

chmod u+x /usr/bin/gitlab_site


You can now run


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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.