本文翻译自:Git keeps asking me for my ssh key passphrase

I created keys as instructed in the github tutorial, registered them with github, and tried using ssh-agent explicitly — yet git continues to ask me for my passphrase every time I try to do a pull or a push. 我按照github教程中的说明创建了密钥,并在github上注册了它们,然后显式尝试使用ssh-agent-但是git每次尝试进行拉式或推式操作时,都会继续询问我密码。

What could be the cause? 可能是什么原因?


#1楼

参考:https://stackoom.com/question/g5tt/Git不断询问我ssh密钥密码


#2楼

It sounds like you may be having trouble with SSH-Agent itself. 听起来您可能无法使用SSH-Agent本身。 I would try troubleshooting that. 我会尝试排除故障。

1) Did you do ssh-add to add your key to SSH? 1)您是否通过ssh-add将密钥添加到SSH?

2) Are you closing the terminal window between uses, because if you close the window you will have to enter the password again when you reopen it. 2)您是否在两次使用之间关闭了终端窗口,因为如果您关闭终端窗口,则在重新打开它时必须再次输入密码。


#3楼

Once you have started the SSH agent with: 使用以下命令启动SSH代理后:

eval $(ssh-agent)
  1. You have to add your private key to it: 您必须在其中添加私钥:

     ssh-add 

    This will ask you your passphrase just once, and then you should be allowed to push, provided that you uploaded the public key to Github. 这将只询问您一次密码,如果您将公钥上传到Github,则应该允许您输入密码。

  2. To save key permanently on macOS: 要在macOS上永久保存密钥:

     ssh-add -K 

    This will persist it after you close and re-open it by storing it in user's keychain. 关闭并通过将其存储在用户的钥匙串中重新打开后,它将保留它。


#4楼

I had a similar issue, but the other answers didn't fix my problem. 我遇到了类似的问题,但是其他答案并没有解决我的问题。 I thought I'd go ahead and post this just in case someone else has a screwy setup like me. 我以为我会继续发布此消息,以防其他人像我一样搞怪设置。

It turns out I had multiple keys and Git was using the wrong one first. 原来我有多个键,而Git首先使用的是错误的键。 It would prompt me for my passphrase, and I would enter it, then Git would use a different key that would work (that I didn't need to enter the passphrase on). 它会提示我输入密码,然后输入密码,然后Git将使用一个可以使用的其他密钥(不需要输入密码)。

I just deleted the key that it was using to prompt me for a passphrase and now it works! 我只是删除了用来提示我输入密码的密钥,现在它可以了!


#5楼

I would try the following: 我会尝试以下方法:

  1. Start GitBash 启动GitBash
  2. Edit your ~/.bashrc file 编辑~/.bashrc文件
  3. Add the following lines to the file 将以下行添加到文件
SSH_ENV=$HOME/.ssh/environment# start the ssh-agent
function start_agent {echo "Initializing new SSH agent..."# spawn ssh-agent/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}echo succeededchmod 600 ${SSH_ENV}. ${SSH_ENV} > /dev/null/usr/bin/ssh-add
}if [ -f "${SSH_ENV}" ]; then. ${SSH_ENV} > /dev/nullps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {start_agent;}
elsestart_agent;
fi
  1. Save and close the file 保存并关闭文件
  2. Close GitBash 关闭GitBash
  3. Reopen GitBash 重新打开GitBash
  4. Enter your passphrase 输入您的密码

#6楼

What worked for me on Windows was (I had cloned code from a repo 1st): 在Windows上对我有用的是(我从仓库1st克隆了代码):

eval $(ssh-agent)
ssh-add
git pull

at which time it asked me one last time for my passphrase 当时它最后一次要求我输入密码

Credits: the solution was taken from https://unix.stackexchange.com/questions/12195/how-to-avoid-being-asked-passphrase-each-time-i-push-to-bitbucket 鸣谢:解决方案取自https://unix.stackexchange.com/questions/12195/how-to-a-avoid-being-asked-passphrase-each-time-i-push-to-bitbucket

Git不断询问我ssh密钥密码相关推荐

  1. 在Linux系统下更改或更新SSH密钥密码的方法

    本文介绍如何在Linux系统下更新或更改SSH密钥密码,也适用在Unix系统中.SSH密钥通常用于向某些信息系统的用户进行身份验证,SSH密钥本身是私钥,使用从密码短语导出的对称加密密钥进一步加密私钥 ...

  2. linux git hudson,如何使用SSH密钥配置Hudson和git插件

    我的Hudson(连续集成系统)的git插件在Tomcat Windows服务上运行.已安装msysgit,并且msysgit bin目录位于路径中.已安装PuTTY / Pageant / plin ...

  3. git 第三天 SSH免密码登录 2

    公钥已经生成,github设置SSH key ssh key 已经添加 还没有激活 显示是灰色的 右键 git bash 输入 ssh git@github.com 然后输入yes 再刷新页面,已激活 ...

  4. 【解决Git ssh 密钥忘记密码】

    前言 如果在之前有创建SSH的时候设置过密码,那就很有可能git操作时出现忘记密码的尴尬情况. 今天我就忘记了密码,在网上找到了解决的方法就记录下来 解决 在ssh密码忘记密码我们是无法去修改的,这个 ...

  5. 如何指定在Git上执行shell命令时使用的私有SSH密钥?

    也许是一个相当不寻常的情况,但我想指定一个私有SSH密钥,以便在从本地计算机执行shell(git)命令时使用. 基本上是这样的: git clone git@github.com:TheUser/T ...

  6. SSH密钥 - 仍然要求输入密码和密码

    本文翻译自:SSH Key - Still asking for password and passphrase I've been somewhat 'putting up' with Github ...

  7. GIT:如何管理本机的多个ssh密钥(多个远程仓库账号)

    生成新ssh key 如果我们电脑上已经存在了一个ssh key,那么我们需要在我们电脑上生成第二个你想在本电脑上使用的id_rsa,使用命令:ssh-keygen -t rsa -C "你 ...

  8. GitHub防黑客新措施:弃用账密验证Git操作,改用token或SSH密钥,今晚0点执行

    萧箫 发自 凹非寺 量子位 报道 | 公众号 QbitAI 还在用账户+密码对GitHub上的Git操作进行身份验证? 赶紧整个token(令牌)或SSH密钥吧! 8月14号0点(8月13日9:00 ...

  9. 使用git实现免密操作、TortoiseGit实现SSH免密码操作

    在使用git进行版本管理的时候,每次pull.push的时候都要提示输入密码,比较麻烦. 本篇博客针对这种情况,介绍如何使用git实现免密操作.TortoiseGit实现SSH免密码操作. 1.环境配 ...

最新文章

  1. 洛谷 1379 八数码难题
  2. C语言实现音乐播放器 客户端相关函数解析(部分
  3. 火炬之光使用了哪些技术
  4. 95-080-046-源码-启动-flink-daemon.sh
  5. 阿里云CentOS Linux 7安全基线检查
  6. 在公司交了十年社保了,退休了,自己还要补交六、七万元社保,你觉得该不该补交?
  7. css分页实例讲解,CSS 分页实例
  8. 乐鑫Esp32学习之旅 12 开源一个微信公众号airkiss配网esp32以及局域网发现功能的工程,分享一个airkiss配网小工具。(附带Demo)
  9. 使用WebDriver 登录163邮箱
  10. 一篇让小百彻底搞懂性能调优
  11. 信用社网银服务器无响应,农村信用社网上银行显无法显示网页
  12. 大数据小结(1-4)
  13. uniapp里css不是识别*,报 error at token “*“
  14. 机器学习-54-RL-06-Actor-Critic(强化学习-A2C,A3C,Pathwise Derivative Policy Gradient)
  15. ionic 以及cordova apk打包成功,安装不成功,显示Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
  16. IF: 8+ m6A调控因子与m6A相关的lnc/mRNA作为结直肠癌预后因子的综合性分析
  17. 在java中使用JDBC连接mysql数据库时的服务器时区值无法识别或表示多个时区的问题解决方案
  18. 拉格朗日乘数法和KKT条件的直观解释
  19. 全国(省,直辖市,自治区,特别行政区)映射集合
  20. 微信公众平台如何操作迁移?迁移公证步骤是什么?

热门文章

  1. Python中通过cx_Oracle访问数据库遇到的问题总结
  2. linux下设置SMTP服务器并用mail命令发送邮件精解
  3. 讲讲金融业务(一)--自助结算终端POS
  4. Hive Udf Rank
  5. java 线程安全问题之静态变量、实例变量、局部变量
  6. 关于SharePoint解决方案开发模型的凌乱文章…
  7. 用C#编写ActiveX控件(二) 转载
  8. 【MySQL笔记】MySql5安装图解教程
  9. urlencode编码问题(以及urlparse)
  10. POJ1006 中国剩余定理