简体   繁体   English

git clone (ssh) 时启用密码提示

[英]enable password prompt when git clone (ssh)

I had to clone my project from GITLAB.我不得不从 GITLAB 克隆我的项目。 I hd generated an ssh key then i added id_rsa.pub to the Gitlab ssh key on web interface of gitlab.我 hd 生成了一个 ssh 密钥,然后我将 id_rsa.pub 添加到 gitlab 网络界面上的 Gitlab ssh 密钥。 When i want to clone with ssh git clone git@..... i need to enter a password.当我想用 ssh git clone git@.....进行克隆时,我需要输入密码。 I thinked that i should enter the password of my user session but it is wrong.我想我应该输入我的用户会话的密码,但它是错误的。 After many attempt, i can't enter the password and i got this error.经过多次尝试,我无法输入密码并出现此错误。

warning: modèles non trouvés /usr/local/share/git-core/templates/
sign_and_send_pubkey: signing failed: agent refused operation

git@site.com: Permission denied (publickey).
fatal: Impossible de lire le dépôt distant.

Veuillez vérifier que vous avez les droits d'accès
et que le dépôt existe.

我认为 Git 要求您提供私钥密码,这是您在生成公钥/私钥时选择的。

I resolved my problem it was a permission problem.我解决了我的问题,这是一个权限问题。 the id_rsa (private key) have a permission too open. id_rsa(私钥)的权限太开放了。 when i run ssh-add ./.ssh/id_rsa this is the result当我运行ssh-add ./.ssh/id_rsa这是结果

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for './.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

the private key should have this permission 600. So i run私钥应该有这个权限 600. 所以我运行

chmod 600 ./.ssh/id_rsa

then i run again然后我又跑了

ssh-add ./.ssh/id_rsa

then i can do git clone with ssh然后我可以用 ssh 做 git clone

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

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