-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在 libgit2 后端中支持密钥保护的 SSH Key #334
Comments
感谢反馈。 我的一个疑问是密码应该放在哪里,最简单的办法是在 Remote 相关设置里面加一个: maa-cli/maa-cli/src/config/cli/resource.rs Lines 45 to 55 in 3fd7bfa
但是明文把密码放在配置文件里面比创建一个无密码的密钥更不安全。或许我们可以在运行时询问用户,但是不知道 git 是如何判断一个 key 需不需要密码的。 另一个选择是使用 ssh-agent, 这样可以避免使用无密码密钥,同时不需要把密码明文存在任何地方。 |
我在 StackExchange 上找到了一篇相关的回答: https://security.stackexchange.com/a/129729 下方的评论中提到了:
我使用的密钥符合这里的介绍。 |
现在你可以使用 ssh-agent 或者密码授权了,具体参见文档 |
问题描述
使用 SSH 克隆 resource 仓库时,如果使用了受密钥保护的私钥,会出现以下错误:
原因分析
参考代码后,发现这处
git2
调用中将passphrase
参数(第 4 个参数)设置成了None
:maa-cli/maa-cli/src/installer/resource.rs
Line 181 in 3fd7bfa
在一个简单测试中,发现只要增加可选的
passphrase
参数即可正常执行:其他方案(workaround)
git
后端,因为其可以提示用户输入密钥The text was updated successfully, but these errors were encountered: