Tutorials
How to Prevent GitHub Copilot CLI from Running Shell Commands
GitHub Copilot CLI 1.0.118 introduces an environment variable that prevents its runtime from launching child processes. Learn how to enable this restriction on Windows, Linux, and macOS, and understand what it does not protect against.
Sometimes you want an AI coding agent to examine a repository without running anything inside it.
Perhaps you are reviewing an unfamiliar project, investigating its architecture, or trying to understand a function without executing its dependencies.
You could simply instruct the agent not to run terminal commands. But an instruction given to an AI model is different from a restriction enforced by its runtime.
On December 1, 2026, GitHub released Copilot CLI 1.0.118, introducing a new environment variable:
COPILOT_ALLOW_PROCESS_SPAWN=0
When configured before startup, it prevents the Copilot runtime from launching child processes, including shell commands and Git operations.
By default, process creation remains permitted, subject to the existing permission system.
1. Install GitHub Copilot CLI 1.0.118
If you installed Copilot CLI through npm, you can select the exact version:
npm install -g @github/[email protected]
Installation through npm requires Node.js 22 or later.
Check which version your terminal actually uses:
copilot --version
This matters particularly on Windows, where separate installations through npm and WinGet can exist on the same machine.
If you suspect that PowerShell is resolving a different installation, inspect the available executables:
Get-Command copilot -All
On Linux or macOS:
type -a copilot
The environment variable introduced in 1.0.118 should not be relied upon when running an older CLI version.
2. Disable process spawning on Windows
Open PowerShell and set the environment variable before launching Copilot:
$env:COPILOT_ALLOW_PROCESS_SPAWN = "0"
copilot
The variable belongs to the current PowerShell process and is inherited by programs launched from it.
Copilot reads the setting when its runtime starts.
Setting the variable in another terminal after Copilot has already launched will not change the environment of the running session. Exit Copilot and start it again with the correct configuration.
You can check the current PowerShell value with:
$env:COPILOT_ALLOW_PROCESS_SPAWN
The expected output is:
0
This confirms that the variable exists in PowerShell. It does not, by itself, prove that the installed Copilot version enforces the restriction.
3. Disable process spawning on Linux and macOS
In Bash or Zsh, the variable can be applied to a single invocation:
COPILOT_ALLOW_PROCESS_SPAWN=0 copilot
Alternatively, export it for subsequent commands in the current shell:
export COPILOT_ALLOW_PROCESS_SPAWN=0
copilot
The difference is mainly its scope.
The first command launches one restricted Copilot session without permanently changing the shell’s environment.
The second makes the variable available to programs subsequently launched from that shell.
For occasional code-review sessions, the first approach is convenient because there is nothing to unset afterward.
4. Check whether the restriction works
Use a small repository that does not contain sensitive information.
Start Copilot normally and ask it to execute these commands:
git status
node --version
npm test
Observe which tools it invokes and whether the commands execute. Normal permission rules still apply.
Then exit the session and launch Copilot again with:
COPILOT_ALLOW_PROCESS_SPAWN=0 copilot
Ask it to perform the same operations.
Based on GitHub’s documented behavior, the expected comparison is:
| Operation | Normal session | Process spawning disabled |
|---|---|---|
git status |
Can execute | Process launch blocked |
node --version |
Can execute | Process launch blocked |
npm test |
Can execute | Process launch blocked |
| Built-in file reading | Available under permissions | Not inherently blocked |
| Built-in file editing | Available under permissions | Not inherently blocked |
These are expected behaviors derived from the documented restriction, not recorded results from an independently executed comparison.
Pay attention to actual tool activity rather than the assistant’s final message.
An agent might provide a plausible explanation of a command’s result without having executed the command. It may also use an available built-in tool to obtain similar information.
For example, the inability to execute Git does not necessarily mean Copilot cannot inspect repository files.
Why blocking child processes is different from denying shell permissions
Copilot already provides several ways to control tool permissions.
For example:
copilot --deny-tool=shell
This denies the agent permission to use shell commands.
So why introduce another restriction?
The two settings operate at different levels.
Shell permissions determine whether the agent may use a particular category of tools. The new environment variable restricts the runtime’s ability to launch child processes.
That distinction becomes relevant when a process is needed for something other than an ordinary terminal command.
A Git integration, local development tool, or subprocess-based extension may also depend on process creation.
GitHub’s release notes explicitly include Git in the new restriction. The corresponding Copilot SDK documentation also identifies sandboxed commands as affected.
A sandboxed shell command still needs a process in which to execute.
Disabling process creation prevents that execution from starting, rather than merely restricting what the resulting process can access.
Does this make Copilot completely read-only?
No.
Consider a coding agent with two available operations:
- Execute a shell command that modifies a file.
- Modify a file through a built-in editing tool.
Only the first necessarily requires launching a child process.
Blocking process creation does not automatically remove the second capability.
The same distinction applies to network requests and external integrations. An operation that does not require the runtime to create a process is not inherently prohibited by this environment variable.
For a more restricted code-review session, combine process-spawn restrictions with an explicit tool allowlist.
In Bash:
COPILOT_ALLOW_PROCESS_SPAWN=0 copilot \
--available-tools='view,grep,glob' \
--deny-tool=write
In PowerShell:
$env:COPILOT_ALLOW_PROCESS_SPAWN = "0"
copilot --available-tools='view,grep,glob' --deny-tool=write
Here, the configuration limits the tools exposed to the agent to file viewing and searching, while separately denying file-writing permissions.
GitHub documents --available-tools as an allowlist for the tools the model can select.
This is still not an operating-system-level security boundary.
The application itself continues running under your user account, and the environment variable does not establish filesystem isolation or a network policy.
For genuinely sensitive environments, use appropriate operating-system permissions, isolated workspaces, and sandboxing alongside the agent’s own restrictions.
What happens to MCP servers?
There is another consequence that may not be immediately apparent.
Some MCP servers are launched locally as child processes. A server configured to start through Node.js, Python, or another executable may fail to initialize when process spawning is disabled.
Remote MCP servers use a different connection mechanism and may not need a local child process.
Consequently, they are not automatically disabled by this setting alone.
The precise behavior depends on how the integration is implemented and which tools remain available.
If an MCP integration stops working after enabling the restriction, inspect its startup configuration before assuming that its authentication or connection settings are broken.
A local server that cannot launch its executable and a remote server that cannot authenticate are different problems, even if both appear unavailable in the CLI.
Restore normal process execution
On Windows, exit Copilot and remove the variable from PowerShell:
Remove-Item Env:COPILOT_ALLOW_PROCESS_SPAWN
copilot
If you exported it in Bash or Zsh:
unset COPILOT_ALLOW_PROCESS_SPAWN
copilot
If you used the single-command Bash syntax earlier, simply launching copilot again is sufficient, provided the variable was not configured elsewhere.
Removing the restriction restores the default process-spawn behavior. It does not automatically grant approval for every shell command.
The ordinary permission system remains in effect.
When is this setting useful?
The restriction is particularly useful when the task involves reading and understanding code rather than executing it.
A repository can contain unfamiliar build scripts, package lifecycle hooks, or instructions embedded in project documentation.
An agent investigating that repository does not always need to run its test suite or install its dependencies.
In such cases, preventing process creation reduces the number of execution paths available to the agent.
There is a trade-off, however.
A coding agent that cannot execute commands cannot independently verify a build, run tests, or obtain certain Git information through local executables.
Its conclusions may therefore be limited to static inspection.
GitHub Copilot CLI 1.0.118 gives developers a way to make that restriction explicit.
The setting does not make an AI agent harmless, nor does it replace tool permissions. It addresses one specific capability: the runtime’s ability to launch additional processes.
For a code-review session where execution is unnecessary, that may be precisely the capability you want to remove.