Open a Github Repo Quickly from the Command Line

If you are a sysadmin or developer that uses a lot of repos throughout the day, and you use Github, this little snippet will come in handy. No more opening a browser window and fumbling around trying to navigate to your repo. Just type gh anywhere inside your project path and a browser window will open your repo on Github.

For this to work, you’ll need to do two things:

  1. Copy the snippet to ~/bin/gh
  2. Make it executable by running: chmod +x ~/bin/gh
  3. Reload or restart your terminal, browse into a Github project, type gh and boom!
Advertisements