To keep to my cli-workflow, I make regular use of the GitHub CLI tool, gh on the command line.

The manual specifies that you can specify the GH_HOST environment variable to direct it to a GitHub Enterprise server, but I don’t want to have to type that in every time. I added the following to my .bashrc:

ghe() { GH_HOST="" gh "$@"; }
complete -o default -F __start_gh ghe

Now, I can just run gh for public GitHub actions, and ghe for anything to do with’s server.

Since I also use yadm for managing my dotfiles, I have this wrapped in a conditional check to only be used if this device is a work machine:

if yadm config --get-all local.class | grep -q "work"; then
    ghe() { GH_HOST="" gh "$@"; }
    complete -o default -F __start_gh ghe

Before GitHub released their official cli tool, I regularly used hub. I keep both installed, because sometimes my fingers are still in the habit of using hub’s syntax. If you’re in the same situation, you can configure hub to use a GitHub Enterprise server:

$ git config --global --add

to add the following to your ~/.gitconfig:

    host =

Add an entry for that host to your ~/.config/hub file:
- user: jlavoie
  oauth_token: ghp_1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
  protocol: https

And an alias in your ~/.bashrc:

alias gite=" hub"