简体   繁体   English

如何在node.js中克隆私有git存储库

[英]How to clone private git repository in node.js

The idea is the following: 这个想法如下:

node.js in the application should be able to clone private github repositories using ssh. 应用程序中的node.js应该能够使用ssh克隆私有github存储库。 After User send his/her ssh key, the application could be able to clone his repository. 用户发送他/她的ssh密钥后,应用程序可以克隆他的存储库。

I think about using GIT_SSH variable to use multiple ssh keys. 我想使用GIT_SSH变量来使用多个ssh密钥。 Can any one tell me how this could be implemented? 谁能告诉我这是如何实现的?

You may want to reconsider the idea of users sending you their private SSH keys. 您可能想重新考虑用户向您发送私有SSH密钥的想法。 I would be very surprised if anyone would do that. 如果有人这样做我会很惊讶。

What you can do instead is to use the GitHub API and deploy keys , that can be made read only. 你可以做的是使用GitHub API部署密钥 ,这些密钥可以只读。 See: 看到:

For a good introduction on how you can access Git repos fron Node, see: 有关如何访问Git repos fron Node的详细介绍,请参阅:

Examples in that article use NodeGit . 该文章中的示例使用NodeGit It has excellent documentation on: 它有很好的文档:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM