SSH 密钥 - 仍然要求输入密码和密码 [英] SSH Key - Still asking for password and passphrase

查看:149
本文介绍了SSH 密钥 - 仍然要求输入密码和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我克隆一个存储库时,我对 Github 总是要求我的用户名和密码有点忍受".我想绕过这一步,因为它是我工作流程中的一个烦恼.

I've been somewhat 'putting up' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance within my workflow.

我尝试使用本指南设置 SSH 密钥(我成功地做到了).https://help.github.com/articles/generating-ssh-keys,我成功了.

I tried setting up an SSH key (which I successfully did) using this guide. https://help.github.com/articles/generating-ssh-keys and I was successful.

我的问题是在克隆存储库(使用 SSH)时仍然要求我提供 github 密码和密码.我的理解是,在我设置了这个 SSH 密钥之后,我就不再需要这样做了.

My problem is that I am still asked for my github password and passphrase when cloning a repository (using SSH). My understanding was that after I set up this SSH key, I would no longer have to do that.

我有点不知道该问什么,所以我只是陈述我的目标.

I am a little unsure what to ask, so I will just state my goal.

我希望能够克隆存储库,而不必一直输入我的 Github 信息.

我的 SSH 密钥缺少什么?如果有人可以提供一些指导或资源,我将不胜感激,因为在 GitHub 中进行 SSH 身份验证时,我总是感到有些迷茫.

What am I missing with my SSH key? If anyone can provide some guidance or resources I would appreciate it, because I've always felt a little lost when it came to SSH authentication in GitHub.

据我所知,这是一个测试是否正常工作的命令,以下是我的控制台的输出:

From my knowledge, this is a command that tests if things are working properly, here are the output from my console:

~ $ ssh -T git@github.com
Saving password to keychain failed
Enter passphrase for key '/Users/MYNAME/.ssh/id_rsa':
Hi MYNAME! You've successfully authenticated, but GitHub does not provide shell access.

当我输入密码时,应该先失败吗?然后,当我输入密码时,它就通过了.

When I input my password, should that fail first? Then, when I enter my passphrase, it passes.

推荐答案

无需钥匙串即可添加身份

有时您可能不想将密码存储在钥匙串中,但又不想一遍又一遍地输入密码.

Add Identity without Keychain

There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.

你可以这样做:

ssh-add ~/.ssh/id_rsa 

这将要求您输入密码,输入它,直到您重新启动它才会再次询问.

This will ask you for the passphrase, enter it and it will not ask again until you restart.

正如@dennis 在评论中指出的那样,要通过将密码存储在您的钥匙串中来保持密码短语通过重新启动,您可以使用 -K 选项(-k 用于Ubuntu)添加这样的身份时:

As @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the -K option (-k for Ubuntu) when adding the identity like this:

ssh-add -K ~/.ssh/id_rsa

再一次,这将要求您输入密码,输入它,这一次它再也不会要求您提供此身份.

Once again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity.

这篇关于SSH 密钥 - 仍然要求输入密码和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆