我在私有存储库中的
github上有一个节点应用程序.此节点应用程序还具有我制作的自定义模块,它们位于单独的专用存储库中.
这是示例节点应用程序URL:
git@github.com:thomas/node-application.git
这些都是节点应用程序使用的节点模块.
git@github.com:thomas/node-module1.git git@github.com:thomas/node-module2.git
您可以使用以下命令在github上安装私有npm模块.
npm install git+ssh://git@github.com:thomas/node_module1.git
为了使其工作,机器需要设置ssh键.
我的本地机器设置了我的github用户密钥并访问我的所有回购.
在我的服务器上,但是我正在使用部署密钥.我知道如何使用多个部署密钥的唯一方法如下.
Host na.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-application ForwardAgent yes Host nm1.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-module1 ForwardAgent yes Host nm2.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-module2 ForwardAgent yes
所以我需要在服务器上安装模块
npm install git+ssh://git@nm1.github.com:thomas/node_module1.git ^^^
这意味着生产和开发的依赖性会有所不同
"node-module": "git+ssh://git@github.com:thomas/node-module1.git"
VS
"node-module": "git+ssh://git@nm1.github.com:thomas/node-module1.git" ^^^
如果我可以做这样的事情,这可能会奏效……
Host github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-application IdentityFile ~/.ssh/gh_node-module1 IdentityFile ~/.ssh/gh_node-module2 ForwardAgent yes
解决方法
您必须使用Deploy Keys为服务器SSH访问您的私有github存储库.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。