Files
pnpm/.changeset/fix-patch-commit-home-env.md
Umesh More cb49a64af7 fix(patch): prevent git config path errors in patch-commit (#10640)
* fix(patch): prevent git config path errors in patch-commit

Replace HOME='' with GIT_CONFIG_GLOBAL to bypass user config
without breaking home directory resolution in restricted environments.

Fixes #6537

* fix(patch): prevent git config path errors in patch-commit

Use GIT_CONFIG_NOSYSTEM and GIT_CONFIG_GLOBAL to bypass git config
without breaking HOME path resolution in restricted environments.

Fixes #6537
2026-02-28 01:37:37 +01:00

12 lines
733 B
Markdown

---
"@pnpm/plugin-commands-patching": patch
"pnpm": patch
---
Fixed `pnpm patch-commit` failing with "unable to access '/.config/git/attributes': Permission denied" error in environments where HOME is unset or non-standard (Docker containers, CI systems).
The issue occurred because pnpm was setting `HOME: ''` and `USERPROFILE: ''` to suppress user git configuration when running `git diff`. This caused git to resolve the home directory (`~`) as root (`/`), leading to permission errors when attempting to access `/.config/git/attributes`.
Now uses `GIT_CONFIG_GLOBAL: os.devNull` instead, which is git's proper mechanism for bypassing user-level configuration without corrupting the home directory path resolution.
Fixes #6537