Work seamlessly with GitHub from the command line
Note: Check the official documentation for the latest supported features and commands.
curl -fsSL https://raw.githubusercontent.com/zero-to-prod/gh/main/install.sh | bash
# Get the LLM Guide
curl https://raw.githubusercontent.com/zero-to-prod/gh/main/LLM_USAGE.md
# Pull the image
docker pull zero-to-prod/gh:latest
# Authenticate (one-time setup)
docker run -it --rm -v ~/.config/gh:/root/.config/gh zero-to-prod/gh auth login
# Run a command (example - requires a git repository)
docker run --rm -v ~/.config/gh:/root/.config/gh -v $(pwd):/workspace -w /workspace zero-to-prod/gh repo list
For convenience, create an alias in your shell configuration (.bashrc, .zshrc):
alias gh='docker run --rm -v ~/.config/gh:/root/.config/gh -v $(pwd):/workspace -w /workspace zero-to-prod/gh'
Before using this Docker image, ensure you have:
Pull the latest image from Docker Hub:
docker pull zero-to-prod/gh:latest
Create a docker-compose.yml:
services:
gh:
image: zero-to-prod/gh:latest
container_name: gh
volumes:
- ~/.config/gh:/root/.config/gh
environment:
- TZ=UTC
Run with:
docker-compose run --rm gh --help
latest - Current stable release (recommended){X.Y.Z} - Specific versions (e.g., 1.1.3){X.Y} - Major.minor versions (e.g., 1.1)GH requires authentication to connect to your instance.
Configure GH with your credentials:
docker run -it --rm -v ~/.config/gh:/root/.config/gh zero-to-prod/gh auth login
Follow the interactive prompts to complete authentication.
Optional environment variables you can set:
docker run --rm \
-e TZ=UTC \
-v ~/.config/gh:/root/.config/gh \
-v $(pwd):/workspace \
-w /workspace \
zero-to-prod/gh [COMMAND]
Essential volumes:
| Volume | Purpose | Required |
|---|---|---|
~/.config/gh:/root/.config/gh | Configuration & credentials | Yes |
$(pwd):/workspace | Current directory access | Optional |
Example with workspace mount (recommended for most commands):
docker run --rm \
-v ~/.config/gh:/root/.config/gh \
-v $(pwd):/workspace \
-w /workspace \
zero-to-prod/gh [COMMAND]
Most CLI tools require git repository context and should use the workspace mount pattern above.
~/.config/gh on your host machine.config/gh to version controlchmod 700 ~/.config/gh# For commands that need git repository context
docker run --rm \
-v ~/.config/gh:/root/.config/gh \
-v $(pwd):/workspace \
-w /workspace \
zero-to-prod/gh [COMMAND] [OPTIONS]
docker run -it --rm \
-v ~/.config/gh:/root/.config/gh \
zero-to-prod/gh [COMMAND] [OPTIONS]
Display help:
# General help
docker run --rm zero-to-prod/gh --help
# Command-specific help
docker run --rm zero-to-prod/gh [COMMAND] --help
Example commands:
# Example command with full volume mounts
docker run --rm \
-v ~/.config/gh:/root/.config/gh \
-v $(pwd):/workspace \
-w /workspace \
zero-to-prod/gh repo list
After adding the alias (see Creating Shell Aliases), restart your shell or run source ~/.bashrc. Then you can use:
# Use the alias for simpler commands
gh repo list
# For interactive commands, add -it manually
docker run -it --rm -v ~/.config/gh:/root/.config/gh zero-to-prod/gh auth login
# Run a command
docker-compose run --rm gh repo list
# Interactive mode
docker-compose run --rm gh
This Docker wrapper includes comprehensive documentation for Large Language Models and AI assistants to help users interact with GitHub CLI.
A complete guide is available in LLM_USAGE.md which includes:
View the LLM guide:
curl https://raw.githubusercontent.com/zero-to-prod/gh/main/LLM_USAGE.md
When helping users with gh commands, always:
~/.config/gh) and workspace ($(pwd):/workspace)Example complete command:
docker run --rm \
-v ~/.config/gh:/root/.config/gh \
-v $(pwd):/workspace \
-w /workspace \
zero-to-prod/gh repo list
docker pull zero-to-prod/gh# Pull the latest version
docker pull zero-to-prod/gh:latest
# Verify the update
docker run --rm zero-to-prod/gh --version
For development or custom builds, see Image Development.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
Please read our:
git checkout -b feature-branch)git commit -m 'Add some feature')git push origin feature-branch)This project is licensed under the MIT License - see LICENSE.md for details.
Maintained by: zero-to-prod Last Updated: 2025-11-16
Content type
Image
Digest
sha256:2acc5ab8a…
Size
21.7 MB
Last updated
11 months ago
docker pull davidsmith3/gh