(诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)

 在为windows 环境下的github账户添加SSH key时,需要在Git Bash执行如下命令:

第一步:检查已有的SSH keys

$ ls -al ~/.ssh

第二步:生成新的SSH key

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

接着会得到如下的提示:

Your identification has been saved in /c/Users/you/.ssh/id_rsa.
# Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

然后将这个新的key添加到ssh-agent中:

$ ssh-agent -s
# Agent pid 59566
$ ssh-add ~/.ssh/id_rsa

*注: 如果执行 ssh-add 时显示错误 Could not open a connection to your authentication agent. 那么执行

eval `ssh-agent -s`

后重新执行 ssh-add 那条命令即可。

 

第三步:将SSH key添加到你的GitHub账户

首先将公钥复制到粘贴板:

$ clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

或者使用文本编辑工具也能解决。

然后在github的账户页的右上角,点击配置(settings, 齿轮图形),在sidebar中点击“SSH keys”,接着点击“Add SSH key”,在"title"栏输入一个自己喜欢的标题,“key”栏中粘贴刚刚复制的公钥内容,最后点击“Add key”按钮。

 

第四步:检查SSH key是否成功设置

$ ssh -T git@github.com
# Attempts to ssh to GitHub

可能会看到如下的警告:

The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?

输入“yes”,如果得到下面的结果,说明你的设置是成功的!

Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.

 

http://www.cnblogs.com/Security-Darren/p/4106328.html

 

时间: 2024-09-17 03:30:36

(诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)的相关文章

关于hexo 安装中添加SSH key到github显示报错

问题描述 关于hexo 安装中添加SSH key到github显示报错 显示如图,使用ss代理后再次运行也显示该错误,请问解决方法? 解决方案 http://bbs.csdn.net/topics/391934948

git建立信任:生成SSH key的方法

从Gitlab上使用ssh方式拉取git代码报错:The remote end hung up unexpected,经过排查,是公钥生成可能有问题,重新生成一下,然后在Gitlab上添加SSH key,再次拉取代码就好了. SSH keys allow you to establish a secure connection between your computer and GitLa.(SSH Kyes用于本机和代码库主机建立信任.) 生成SSH Key Open Git Bash. Pa

Git与GitHub学习笔记(七)Windows 配置Github ssh key

前言 SSH是建立在应用层和传输层基础上的安全协议,其目的是专为远程登录会话和其他网络服务提供安全性的保障,用过SSH远程登录的人都比较熟悉,可以认为SSH是一种安全的Shell.SSH登录是需要用户名和密码的,要实现无密码登录,就需要创建SSH 密钥(ssh key),SSH 密钥可以认为是和另一台电脑通信时的唯一的识别证,SSH 密钥对可以让我们方便的登录到 SSH 服务器,而无需输入密码.GIT源代码管理就是使用此种安全机制,本文本将介绍SSH KEY的生成过程. >>>不知道配置

TortoiseGit为github账号添加SSH keys,解决pull总是提示输入密码的问题

每次同步或者上传代码到githun上的代码库时,需要每次都输入用户名和密码,这时我们设置一下SSH key就可以省去这些麻烦了.若果使用TortoiseGit作为github本地管理工具,TortoiseGit使用扩展名为ppk的秘钥,而不是ssh-keygen生成的rsa密钥.也就是说使用ssh-keygen -C "username@email.com" -t rsa产生的密钥TortoiseGit中不能用.而基于github的开发必须要用到rsa密钥,因此需要用到Tortoise

应用TortoiseGit为github账号添加SSH keys,解决pull总是提示输入密码的问题

每次同步或者上传代码到githun上的代码库时,需要每次都输入用户名和密码,这时我们设置一下SSH key就可以省去这些麻烦了.若果使用TortoiseGit作为github本地管理工具,TortoiseGit使用扩展名为ppk的秘钥,而不是ssh-keygen生成的rsa密钥.也就是说使用ssh-keygen -C "username@email.com" -t rsa产生的密钥TortoiseGit中不能用.而基于github的开发必须要用到rsa密钥,因此需要用到Tortoise

ssh连接时去掉“The authenticity of host xx can’t be established”解决方法

但前阵子我做备份系统恢复演习时才发现,我的rsync已经很久都没有sync成功了.我本来是采用密钥交换的方式来完成ssh中的验证,但可能由于主机的Key有变化,每次ssh连接(或rsync)时就会有提示:The authenticity of host *** can't be established ,需要输出一个"yes"的交互. 对于这个提示,我的脚本中一开始没有预知,所以没有做判断和处理(用expect也是容易处理的),所以我决定去掉这样的提示(关于宿主机的检查). 1. 使用

Git SSH Key 生成步骤

Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置. github的SSH配置如下: 一 . 设置Git的user name和email: $ git config --global user.name "xuhaiyan" $ git config --global user.email "haiyan.xu.vip@gmail.com"   二.生成SSH密钥过程:1.查看是否已经有了ssh密钥:cd ~/.ss

wpf-想给这段代码生成的按钮添加个按压时按钮改变颜色的效果 哪位大神帮助一下?

问题描述 想给这段代码生成的按钮添加个按压时按钮改变颜色的效果 哪位大神帮助一下? <Window.Resources> <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{

关于github的ssh, permission denied(publickey)

http://www.douban.com/note/201614252/ 关于github的ssh, permission denied(publickey) 2012-02-20 19:30:00 总之linux系统经常会出现这个问题. 下面是姐姐尝试过的一个command.可以一一使用咯.这个东西很~~~ 先看你的能不能用: ssh -T git@github.com 可以的话会告诉你: hi your_name.....success.....but no shell access(具体