github / github/copilot-cli

Permission denied error on worktree index.lock when committing from VS Code (Electron sandbox issue with git)

Open
#1,301 0 comments 0 reactions 0 assignees View on GitHub
area:permissions
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the bug

In a VS Code window opened on a Git worktree, I'm getting a permissions error when trying to commit staged changes. The error message is:

```
[0204/181621.495272:ERROR:electron/shell/app/node_main.cc:146] Node.js environment variables are disabled because this process is invoked by other apps.
fatal: Unable to create '/Users/cv/Documents/Projects/GEO-Skunkworks/geo-experiments-new/.git/worktrees/exp-azure-hosted-agent-claude-code/index.lock': Operation not permitted
```

This prevents committing from that window. The files are already staged, and committing from the terminal outside VS Code works as expected.

### Affected version

_No response_

### Steps to reproduce the behavior

1. Open a VS Code window on a Git worktree (not the main repo).
2. Stage changes to files in the worktree.
3. Attempt to commit using the built-in Git tools in VS Code or via the integrated terminal.
4. Observe the error:
[0204/181621.495272:ERROR:electron/shell/app/node_main.cc:146] Node.js environment variables are disabled because this process is invoked by other apps.
fatal: Unable to create '/path/to/.git/worktrees/worktree-name/index.lock': Operation not permitted

### Expected behavior

I expected to be able to commit staged changes from the VS Code window on the worktree without permission errors, similar to committing from the main repo or an external terminal.

### Additional context

Screenshot showing error and terminal output

- macOS
- VS Code, using built-in Git support
- Problem occurs only in worktrees
- External terminal can commit successfully
- Error mentions Electron, possibly points to a Node.js/electron/VSC sandbox issue
- Path permissions appear correct
- No visible lock files blocking the process

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.