Wraps the official GitHub CLI feature and adds persistent volume mounts for config and state.
"features": {
"ghcr.io/sliekens/devcontainer-features/github-cli:1": {}
}Copy the block below into a chat with your coding agent:
Add
ghcr.io/sliekens/devcontainer-features/github-cli:1to this project's Dev Container. Follow https://github.com/sliekens/devcontainer-features/blob/main/src/github-cli/README.md. Use the collection's sharedinitializeCommandpipeline (devcontainer + jq + xargs overcustomizations.sliekens[].initializeCommand) for host bind pre-create; Unix/WSL2 only. Prefer that over hand-writtenmkdirunless asked.
This feature does not expose configurable options.
| Host path | Container path | Purpose |
|---|---|---|
~/.config/gh |
/var/lib/github-cli/config |
Configuration |
~/.local/share/gh |
/var/lib/github-cli/state |
State |
These directories are bind-mounted from the host so that auth and configuration are preserved across container rebuilds.
Docker cannot bind-mount host paths that do not yet exist. Each feature in this collection that needs host paths declares a host init command under customizations.sliekens.initializeCommand. Wire a single initializeCommand in your devcontainer.json to run all of them (works for any number of features):
"initializeCommand": "devcontainer read-configuration --workspace-folder . --include-merged-configuration | jq -r '(.mergedConfiguration.customizations.sliekens // []) | .[] | .initializeCommand' | xargs -I{} bash -c {}"Requires devcontainer and jq on the host PATH.
Note: This host init pipeline runs only on Unix-like systems (Linux, macOS, and source code inside WSL2 on Windows). Native Windows (
cmd.exe) is not supported — the Dev Containers CLI runsinitializeCommandvia/bin/sh -con Unix andcmd.exe /con native Windows.
If you prefer not to automate with the Dev Containers CLI, jq, and xargs, pre-create the host paths yourself in initializeCommand:
"initializeCommand": "mkdir -p \"$HOME/.config/gh\" \"$HOME/.local/share/gh\""This feature is released under the MIT License.
The installed tool is subject to its own license: GitHub CLI license.
- Declare
customizations.sliekens.initializeCommandfor composable host path pre-create; document automated and manualinitializeCommandwiring.
- Add trailing slash to bind mount source paths to mark them explicitly as directories.
- Use bind mounts from host
~/.config/ghand~/.local/share/ghinstead of Docker volumes for persistent state.
- Initial release.