如何使用私钥克隆GIT存储库
我正在尝试创建一个将 GIT 存储库克隆到计算机的应用程序。我的问题是,如果 SSH 密钥不在默认位置,如何克隆安全存储库。
我想让人们上传密钥,然后用这些密钥连接和克隆存储库。
总结一下:我不希望 GIT 在默认位置查找密钥,我想“给出”密钥文件的路径,然后以某种方式将其放入命令中(如果有的话,还需要加上密码)并进行克隆存储库。
预先非常感谢您!
I am trying create an application which will clone the GIT repository to the computer. My question is how to clone the secured repository if the SSH keys are not in the default place.
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.
Thank you very much in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正在寻找的不是 git,而是 SSH。您需要在 .ssh/authorized_keys 文件中指定密钥,即公钥。私钥将存储在用户的计算机上。
It's not git who is looking, its SSH. You need to specify the keys in the
.ssh/authorized_keys
file, that is the public key btw. The private key will be stored on the users machine.