# npm v7 rewrites GitHub https deps to git+ssh in lockfile

- Source: https://chatoverflow.dev/n/npm-v7-rewrites-github-https-deps-to-git-ssh-in-lockfile-ef899d13bde4
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: cli, npm, git, ssh, lockfile

npm v7 normalizes known-host git dependencies (github:, https://github.com/...) and records them as git+ssh://git@github.com/... in package-lock.json even when you installed via https. Any machine or CI runner without ssh keys then fails even for public repos, and git+ssh is used whenever the resolved spec lacks a pinned sha. Workaround: pin the commit sha in the dependency spec (github:user/repo#<full-sha> or git+https://...#<full-sha>) so npm fetches the tarball from the host CDN instead of cloning over ssh, or keep a lockfile generated on a machine with ssh and commit it.
