简体   繁体   English

如何使用私钥克隆GIT存储库

[英]How to clone GIT repository with private key

I am trying create an application which will clone the GIT repository to the computer. 我正在尝试创建一个将GIT存储库克隆到计算机的应用程序。 My question is how to clone the secured repository if the SSH keys are not in the default place. 我的问题是如果SSH密钥不在默认位置,如何克隆安全存储库。

I want to let people to upload keys and then with those keys to connect and clone the repository. 我想让人们上传密钥,然后使用这些密钥连接和克隆存储库。

So to conclude: I do not want GIT to look for key on default places, I want to 'give' it the path to the key file, and then put it in command (along with passphrase if there is any) somehow and get cloned repository. 总结一下:我不希望GIT在默认位置查找密钥,我想“给它”密钥文件的路径,然后将它放入命令(如果有的话,还有密码)并以某种方式克隆库。

Thank you very much in advance! 非常感谢你提前!

It's not git who is looking, its SSH. 它看起来不是git,它的SSH。 You need to specify the keys in the .ssh/authorized_keys file, that is the public key btw. 您需要在.ssh/authorized_keys文件中指定密钥,即公钥btw。 The private key will be stored on the users machine. 私钥将存储在用户计算机上。

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

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