Summary
The Makefile target test-e2e-full (line 85) runs sudo -E go test, which creates test artifacts and cached files owned by root in the user's repository. This is the primary cause of the "unable to unlink old file: Permission denied" error during subsequent git pull operations.
Evidence
test-e2e-full:
sudo -E go test -v -tags=e2e_full -timeout=60m ./test/e2e/full/...
After running this, 888 files become root-owned in the repo.
Proposed Fix
- Run e2e tests in a container or VM (not in the source tree with sudo)
- If sudo is required, add a cleanup step:
sudo chown -R $(whoami):$(whoami) .
- Use
go test -exec sudo pattern instead of sudo go test
- Add
npm run repo:fix as post-test cleanup
References
- POSIX file deletion requires write permission on parent directory
- Git cannot unlink files in root-owned directories when running as non-root user