Skip to content

GitHub CLI installable feature ​

Optional Feature

This feature is not preinstalled in Kloud Workspace. Install it with the features system first.

GitHub logo

The gh feature installs the GitHub CLI with its shell completion. With a token set, the workspace signs gh in when a new container starts.

Installation ​

Install gh using the features system:

sh
# Manual installation
ws-cli feature install gh

# Or at boot time
docker run \
  -e WS_FEATURES_ADDITIONAL_FEATURES="gh" \
  ghcr.io/kloudkit/workspace:v0.6.2

The gh feature is available from the feature store.

Sign In with a Token ​

Provide a GitHub personal access token:

  • WS_AUTH_GITHUB_TOKEN: GitHub personal access token for the workspace and gh.
sh
docker run \
  -e WS_AUTH_GITHUB_TOKEN="<token>" \
  -e WS_FEATURES_ADDITIONAL_FEATURES="gh" \
  ghcr.io/kloudkit/workspace:v0.6.2

When a new container starts, the workspace installs the boot-time features first, then passes the token to gh auth login --with-token. If the login fails, the workspace logs a warning and keeps starting. When gh is not installed, the token step is skipped.

The workspace removes WS_AUTH_GITHUB_TOKEN from the editor's environment, so terminals opened in the editor do not see the token.

💡 TIP

WS_AUTH_GITHUB_TOKEN is a secret.

Besides the literal value, you can supply it as a file: reference (file:/path/to/token) or mount it at /run/secrets/workspace/auth/github_token.

After a Manual Install ​

The token sign-in runs only when a new container starts. After ws-cli feature install gh in a running workspace, sign in yourself:

sh
gh auth login

Git over HTTPS ​

The token signs in gh only. It does not set up HTTPS authentication for git in the terminal: use SSH or a credential helper, as described on the Git page.

Released under the MIT License