Skip to content

[BUG] npm install resolved https with PAT as git+ssh  #2631

@koooge

Description

@koooge

Hi there,

Current Behavior:

npm@7 install from https://github with PAT resolved as git+ssh://. Is this intended?

pacakge.json

"foo": "git+https://github.com/bar/baz.git",

package-lock.json

... 
  "resolved": "git+ssh://[email protected]/bar/baz.git#..."
...

Expected Behavior:

package-lock.json

... 
  "resolved": "git+https://github.com/bar/baz.git#..."
...

It's because I have some hacks to keep the PAT a secret. like:

git config --global url."https://${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"

This hack worked in npm@6, but npm@7 didn't.

Steps To Reproduce:

1. Create a private repository of npm on GitHub
2. npm install above 1 with PAT. 
3. npm ci on another env with above GITHUB_TOKEN hack.  #=> error

Environment:

  • OS: macOS 11.2
  • Node: 14.15.4
  • npm: 7.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions