Repository navigation
pnpm manager can't authenticate git+https:// dependencies during lockfile regeneration. (Mend-hosted) #47329
Replies: 1 comment
|
There is an existing PR for this: #40162. It adds Git authentication to pnpm's lockfile-update environment, and is still open. I checked current
So I would not keep changing the host rule expecting a registry setting to fix this path. For the Mend-hosted run, the missing piece needs to be addressed in the runner/package-manager integration. The existing PR is the useful place to track it. Publishing the dependency to an npm registry would use the supported registry-auth path, if that is an acceptable alternative for your project. There may also be a separate malformed URL/rewrite in the example: the error contains This is a source check, not a reproduction of your hosted job. The Renovate and pnpm versions from the job would help tie it to a specific released implementation. |
Uh oh!
There was an error while loading. Please reload this page.
What would you like help with?
None
Please share the URL to the organisation you're creating this request for
No response
Additional information
Summary:
My
package.jsonhas private dependencies specified asgit+https://URLs (not registry packages), e.g.:"private-git-dep": "git+https://github.com/myorg/private-git-dep.git#branch"
I added a PAT token in Mend's secrets (
PRIVATE_GITHUB_REPO_TOKEN) and configuredhostRulesfor the git hosthostRules: [
{ matchHost: "github.com", token: "{{ secrets.PRIVATE_GITHUB_REPO_TOKEN }}", hostType: "github" }
]
Also tried path-scoped
matchHost: "https://github.com/myorg", with and withouthostType. Same result every time.Log snippet
Error: ERR_PNPM_GIT_RESOLVE_FAILED
Failed to resolve git dependency "git+https://github.com/myorg/private-git-dep.git#branch":
git ls-remote failed: fatal: could not read Username for 'https://github.com/myorg/private-git-dep.git'
Below is the actual error object:
I went through the private-packages docs section by section. Every manager has its own documented credential mechanism for artifact updates (e.g. gomod writes
GIT_CONFIG_*env vars fromhostRules) — but there's no equivalent documented for npm/pnpm when the dependency is agit+https://URL rather than a registry package.Is this a known limitation, or is there an undocumented way to get npm/pnpm's artifact-update step to pass git credentials the way gomod does?
All reactions