且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用私有 Github 存储库作为 npm 依赖项

更新时间:2022-04-08 05:17:49

可以通过 https 和 oauth ssh.

It can be done via https and oauth or ssh.

https 和 oauth: 创建一个访问令牌,它具有repo"范围和然后使用这个语法:

https and oauth: create an access token that has "repo" scope and then use this syntax:

"package-name": "git+https://<github_token>:x-oauth-basic@github.com/<user>/<repo>.git"

ssh: 设置 ssh 然后使用以下语法:

ssh: setup ssh and then use this syntax:

"package-name": "git+ssh://git@github.com:<user>/<repo>.git"

(注意在用户前使用冒号而不是斜线)

(note the use of colon instead of slash before user)