Run the GitHub Copilot CLI from any directory on your machine, inside a sandboxed Docker container that automatically uses your existing gh authentication.
This project solves a simple problem: you want to use the awesome GitHub Copilot CLI, but you also want a clean, portable, and secure environment for it.
The copilot_here shell function is a lightweight wrapper around a Docker container. When you run it in a terminal, it:
- Enhances security by isolating the tool in a container, granting it file system access only to the directory you're currently in. π‘οΈ
- Keeps your machine clean by avoiding a global Node.js installation.
- Authenticates automatically by using your host machine's existing
ghCLI credentials. - Validates token permissions by checking for required scopes and warning you about overly permissive tokens.
- Persists its configuration, so it remembers which folders you've trusted across sessions.
- Stays up-to-date by automatically pulling the latest image version on every run.
Before you start, make sure you have the following installed and configured on your machine:
- Docker Desktop (or Docker Engine on Linux).
- The GitHub CLI (
gh). - You must be logged in to the GitHub CLI. You can check by running
gh auth status. Your token must have thecopilotscope. If it doesn't, rungh auth refresh -h github.com -s copilotto add it.
Choose your platform below. The scripts include both Safe Mode (asks for confirmation) and YOLO Mode (auto-approves) functions. You can use either or both depending on your needs.
Safe Mode (copilot_here) - Always asks for confirmation before executing commands. Recommended for general development work where you want control over what gets executed.
YOLO Mode (copilot_yolo) - Automatically approves all tool usage without confirmation. Convenient for trusted workflows but use with caution as it can execute commands without prompting.
All functions support switching between Docker image variants using flags:
- No flag - Base image (Node.js, Git, basic tools)
-dor--dotnet- .NET image (includes .NET 8 & 9 SDKs)-dpor--dotnet-playwright- .NET + Playwright image (includes browser automation)
-hor--help- Show usage help and examples (Bash/Zsh) or-h/-Help(PowerShell)--no-cleanup- Skip cleanup of unused Docker images (Bash/Zsh) or-NoCleanup(PowerShell)--no-pull- Skip pulling the latest image (Bash/Zsh) or-NoPull(PowerShell) --update-scripts Update scripts from GitHub repository --upgrade-scripts Alias for --update-scripts
β οΈ Security Note: Both modes check for proper GitHub token scopes and warn about overly privileged tokens.
Quick Install (Recommended):
Download and source the script in your shell profile:
# Download the script
curl -fsSL https://raw.githubusercontent.com/GordonBeeming/copilot_here/main/copilot_here.sh -o ~/.copilot_here.sh
# Add to your shell profile (~/.zshrc or ~/.bashrc) - only if not already there
if ! grep -q "source ~/.copilot_here.sh" ~/.zshrc 2>/dev/null; then
echo '' >> ~/.zshrc
echo 'source ~/.copilot_here.sh' >> ~/.zshrc
fi
# Reload your shell
source ~/.zshrc # or source ~/.bashrcTo update later, just run: copilot_here --update-scripts
Manual Install (Alternative):
If you prefer not to use the quick install method, you can manually copy the script file:
-
Download the script:
curl -fsSL https://raw.githubusercontent.com/GordonBeeming/copilot_here/main/copilot_here.sh -o ~/.copilot_here.sh -
Add to your shell profile (
~/.zshrcor~/.bashrc):source ~/.copilot_here.sh
-
Reload your shell:
source ~/.zshrc # or source ~/.bashrc
Note: If you want to disable the auto-update functionality, you can remove the --update-scripts and --upgrade-scripts case blocks from the downloaded script file.
Quick Install (Recommended):
Download and source the script in your PowerShell profile:
# Download the script
$scriptPath = "$env:USERPROFILE\Documents\PowerShell\copilot_here.ps1"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/GordonBeeming/copilot_here/main/copilot_here.ps1" -OutFile $scriptPath
# Add to your PowerShell profile - only if not already there
if (-not (Select-String -Path $PROFILE -Pattern "copilot_here.ps1" -Quiet -ErrorAction SilentlyContinue)) {
Add-Content $PROFILE "`n. $scriptPath"
}
# Reload your profile
. $PROFILETo update later, just run: Copilot-Here -UpdateScripts
Manual Install (Alternative):
If you prefer not to use the quick install method, you can manually copy the script file:
-
Download the script:
$scriptPath = "$env:USERPROFILE\Documents\PowerShell\copilot_here.ps1" Invoke-WebRequest -Uri "https://raw.githubusercontent.com/GordonBeeming/copilot_here/main/copilot_here.ps1" -OutFile $scriptPath
-
Add to your PowerShell profile:
# Add this line to your PowerShell profile . $scriptPath
To edit your profile, run:
notepad $PROFILE -
Reload your PowerShell profile:
. $PROFILE
Note: If you want to disable the auto-update functionality, you can remove the -UpdateScripts and -UpgradeScripts parameter blocks from the downloaded script file.
Once set up, using it is simple on any platform.
Start a full chat session with the welcome banner:
Base image (default):
# Linux/macOS
copilot_here
# Windows
copilot_hereWith .NET image:
# Linux/macOS
copilot_here -d
copilot_here --dotnet
# Windows
copilot_here -d
copilot_here -DotnetWith .NET + Playwright image:
# Linux/macOS
copilot_here -dp
copilot_here --dotnet-playwright
# Windows
copilot_here -dp
copilot_here -DotnetPlaywrightGet help:
# Linux/macOS
copilot_here --help
copilot_yolo --help
# Windows
copilot_here -Help
copilot_yolo -HelpPass a prompt directly to get a quick response.
Safe Mode (asks for confirmation before executing):
# Linux/macOS - Base image
copilot_here "suggest a git command to view the last 5 commits"
copilot_here "explain the code in ./my-script.js"
# Linux/macOS - .NET image
copilot_here -d "build and test this .NET project"
copilot_here --dotnet "explain this C# code"
# Linux/macOS - .NET + Playwright image
copilot_here -dp "run playwright tests for this app"
# Linux/macOS - Skip cleanup and pull for faster startup
copilot_here --no-cleanup --no-pull "quick question about this code"
# Windows - Base image
copilot_here "suggest a git command to view the last 5 commits"
# Windows - .NET image
copilot_here -d "build and test this .NET project"
copilot_here -Dotnet "explain this C# code"
# Windows - .NET + Playwright image
copilot_here -dp "run playwright tests for this app"
# Windows - Skip cleanup and pull for faster startup
copilot_here -NoCleanup -NoPull "quick question about this code"YOLO Mode (auto-approves execution):
# Linux/macOS - Base image
copilot_yolo "write a function that reverses a string"
copilot_yolo "run the tests and fix any failures"
# Linux/macOS - .NET image
copilot_yolo -d "create a new ASP.NET Core API project"
copilot_yolo --dotnet "add unit tests for this controller"
# Linux/macOS - .NET + Playwright image
copilot_yolo -dp "write playwright tests for the login page"
# Linux/macOS - Skip cleanup for faster execution
copilot_yolo --no-cleanup "generate a README for this project"
# Windows - Base image
copilot_yolo "write a function that reverses a string"
# Windows - .NET image
copilot_yolo -d "create a new ASP.NET Core API project"
copilot_yolo -Dotnet "add unit tests for this controller"
# Windows - .NET + Playwright image
copilot_yolo -dp "write playwright tests for the login page"
# Windows - Skip cleanup for faster execution
copilot_yolo -NoCleanup "generate a README for this project"This project provides multiple Docker image variants for different development scenarios. All images include the GitHub Copilot CLI and inherit the base security and authentication features.
Tag: latest
The standard Copilot CLI environment with Node.js 20, Git, and essential tools. Use this for general-purpose development and scripting tasks.
# Already configured in the setup instructions above
copilot_here() {
local image_name="ghcr.io/gordonbeeming/copilot_here:latest"
# ... rest of function
}Tag: dotnet
Extends the base image with .NET SDK support for building and testing .NET applications.
Includes:
- .NET 8.0 SDK
- .NET 9.0 SDK
- ASP.NET Core runtimes
- All base image features
Usage:
# Update the image_name in your function to use the .NET variant
local image_name="ghcr.io/gordonbeeming/copilot_here:dotnet"Best for: .NET development, building/testing .NET applications, ASP.NET Core projects
Tag: dotnet-playwright
Extends the .NET image with Playwright browser automation capabilities.
Includes:
- Everything from the .NET image
- Playwright 1.56.0
- Chromium browser with dependencies
- FFmpeg for video recording
Usage:
# Update the image_name in your function to use the .NET + Playwright variant
local image_name="ghcr.io/gordonbeeming/copilot_here:dotnet-playwright"Best for: .NET web testing, browser automation, E2E testing with Playwright
Note: This image is approximately 500-600MB larger than the .NET image due to Chromium browser binaries.
- Use
latestfor general development, scripting, and Node.js projects - Use
dotnetwhen working with .NET projects without browser testing needs - Use
dotnet-playwrightwhen you need both .NET and browser automation capabilities
Future variants may include Python, Java, and other language-specific toolchains.
- Docker Images Documentation - Details about available image variants
- Task Documentation - Development task history and changes
This project is licensed under the MIT License.