Skip to content

[BUG] Permission denied (publickey) when installing from private Git repository on Windows #2891

@thexeos

Description

@thexeos

Current Behavior:

Running npm i git+ssh://git@domain.com:namespace/repo.git through PowerShell on Windows results in the following error:

npm ERR! command failed
npm ERR! command git ls-remote git@git.domain.com:namespace/repo.git
npm ERR! git@domain.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

Running the failed git ls-remote git@git.domain.com:namespace/repo.git command in the same PowerShell window immediately, after correctly prompts for the password:

Enter passphrase for key '/c/Users/Name/.ssh/id_rsa':

Expected Behavior:

When SSH key used for accessing Git repo requires a password, npm should prompt for it within PowerShell.

Steps To Reproduce:

This can also be reproduced by adding an entry to package.json and then running npm i

Environment:

  • OS: Window 10
  • Node: 14.4.0
  • npm: 7.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 releaseplatform:windowsis Windows-specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions