Skip to content

Add --no-git-checks when publishing from pnpm - #43

Open
gndelia wants to merge 1 commit into
mainfrom
fix-pnpm-publish
Open

Add --no-git-checks when publishing from pnpm#43
gndelia wants to merge 1 commit into
mainfrom
fix-pnpm-publish

Conversation

@gndelia

@gndelia gndelia commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Using pnpm publish requires the package to be deployed from a branch. See publish docs.

This is a problem because libraries are released with tags. pnpm doesn't support this - the pnpm publish command just fails. See pnpm/pnpm#5894

The only workaround is adding the flag --no-git-checks. Disabling this check will disable these 4 checks on publish time (none of these are really relevant):

  • Clean working tree (GIT_UNCLEAN) — runs git status --porcelain and fails if anything is uncommitted or untracked. In your run this check already passed before the branch error.
  • HEAD attached to a branch (GIT_UNKNOWN_BRANCH) — reads .git/HEAD, then falls back to git symbolic-ref --short HEAD. Fails when HEAD is detached. This is the one that broke the release.
  • Branch matches publish-branch (GIT_NOT_CORRECT_BRANCH) — compares the branch name against master|main by default. On a mismatch it asks for interactive confirmation, so with no TTY it fails regardless.
  • Local history matches the remote (GIT_NOT_LATEST) — runs git rev-list --count --left-only @{u}...HEAD and fails if the upstream is ahead. A detached HEAD has no upstream, so the command errors, the catch swallows it, and the check returns clean. It is already a no-op in CI.

(Yup - that's AI ☝🏽 )

It seems we can safely enable it to allow using pnpm for publishing.

@gndelia gndelia self-assigned this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant