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

发布于 2024-10-05 05:55:09 字数 206 浏览 1 评论 0原文

我正在尝试创建一个将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愚人国度 2024-10-12 05:55:10

正在寻找的不是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文