Skip to content

Commit 62855a1

Browse files
stranmaclaude
andcommitted
fix: handle Windows read-only git pack files on devcontainer clone
shutil.rmtree fails on Windows when removing .git/objects/pack/*.idx files because they're marked read-only. Add onerror handler to chmod before unlink. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cb957e2 commit 62855a1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

setup_project.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,11 @@ def setup_devcontainer(root: Path, *, devcontainer: str, egress_firewall: bool)
508508
# Remove .git from the clone (we don't want a submodule)
509509
git_dir = dc_dir / ".git"
510510
if git_dir.exists():
511-
shutil.rmtree(git_dir)
511+
# Handle Windows read-only pack files
512+
def _remove_readonly(func, path, _):
513+
os.chmod(path, 0o700)
514+
func(path)
515+
shutil.rmtree(git_dir, onerror=_remove_readonly)
512516
actions.append(" Cloned trailofbits/claude-code-devcontainer into .devcontainer/")
513517
except subprocess.CalledProcessError as e:
514518
actions.append(f" WARNING: Failed to clone Trail of Bits devcontainer: {e}")

0 commit comments

Comments
 (0)