(诊断)为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
(诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)的更多相关文章
- github添加ssh key报错Key is invalid. Ensure you've copied the file correctly
github添加ssh key的时候报错:Key is invalid. Ensure you've copied the file correctly 将秘钥复制粘贴到文本编辑器中,再粘贴复制到
- 为github添加ssh key
用git关联github上的远程仓库前需要先为github添加ssh key 一.检查本机是否生成ssh key 本地查找.ssh文件,其中id_rsa.pub中的内容就是ssh key 二.为git ...
- 如何给 GitHub 添加 SSH key, 如何生成 SSH key 详细图文教程!
如何给 GitHub 添加 SSH key, 如何生成 SSH key 详细图文教程! 一. 生成 SSH key https://ide.c9.io/xgqfrms/ 创建一个空项目:(或使用 ...
- github 添加 SSH key
在 github 上添加 SSH key 的步骤: 1.首先需要检查你电脑是否已经有 SSH key 运行 git Bash 客户端,输入如下代码: $ cd ~/.ssh $ ls 这两个命令就是检 ...
- github添加SSH Key
1.背景介绍 缘由:在github上下载goagent时出现错误. 在终端使用命令:git clone git@github.com:phuslu/goagent.git 会报权限错误如下: Clon ...
- permission denied (publickey)问题的解决 和 向github添加ssh key
使用ssh key这种方式进行clone ,pull github上面的项目,使用 git clone或者git pull origin master出现permission denied (publ ...
- permission denied (publickey)问题的解决和向github添加ssh key
使用ssh key这种方式进行clone ,pull github上面的项目,使用 git clone或者git pull origin master出现permission denied (publ ...
- 执行ssh-add时出现Could not open a connection to your authentication agent
若执行ssh-add /path/to/xxx.pem是出现这个错误:Could not open a connection to your authentication agent,则先执行如下命令 ...
- github入门:设置添加ssh key<转>
GitHub是个分布式的版本控制库.github通过git使用,可以方便的记录代码版本. 通过github可以学习优秀的代码,可以改进提交其他项目中的bug,借助社区力量促进软件优化完善. 国内外大量 ...
随机推荐
- Java多线程之synchronized(五)
上篇介绍了用synchronized修饰static方式来实现“Class 锁”,今天要介绍另一种实现方式,synchronized(class)代码块,写法不一样但是作用是一样的.下面我附上一段代码 ...
- 两种方式在Tableau Desktop 中创建子弹图(Bullet Chart)
子弹图,顾名思义是由于该类信息图的样子很想子弹射出后带出的轨道.起初,子弹图的发展是为了取代仪表盘上常见的那种里程表,时速表等基于圆形的信息表达方式.子弹图无修饰的线性表达方式使我们能够在狭小的空间中 ...
- JSPatch技术文档
一.背景需求介绍 为什么我们需要一个热修复(hot-fix)技术? 工作中容易犯错.bug难以避免. 开发和测试人力有限. 苹果Appstore审核周期太长,一旦出现严重bug难以快速上线新版本. 作 ...
- Java之对象序列化和反序列化
一.对象序列化和反序列化存在的意义: 当你创建对象,只要你需要,他就一直存在,但当程序结束,对象就会消失,但是存在某种情况,如何让程序在不允许的状态,仍然保持该对象的信息.并在下次程序运行的时候使用该 ...
- iOS推送介绍
iOS消息推送的工作机制可以简单的用下图来概括: Provider是指某个iPhone软件的Push服务器,APNS是Apple Push Notification Service的缩写,是苹果的服务 ...
- centos安装epel源
用163的源,但是我发现这个源里面,根本没有libmcrypt libmcrypt-devel这二个包,装php扩展mcrypt时,又要用到这二个包,所以我手动装了libmcrypt包,但是给我的感觉 ...
- Python每日一练(3):爬取百度贴吧图片
import requests,re #先把要访问URL和头部准备好 url = 'http://tieba.baidu.com/p/2166231880' head = { 'Accept': '* ...
- 我的ubuntu
题外话:不知不觉也已经大三,最近思考了很多.在腾讯网看到了对李嘉诚的一篇专访,感触颇深. 想起来我从第一次接触ubuntu到现在也有一年了,记得第一个版本还是12.04,不过很快就换成了12.10,在 ...
- c++ 实现将数字转换为中文数字输出
实现如下函数: void printInChinese(int num); 这个函数输入一个小于100000000(一亿)的正整数,并在屏幕上打印这个数字的中文写法. 例如: 17 -> 一十七 ...
- STL insert()使用
下面我以vector的insert()为例: c++ 98: single element (1) iterator insert (iterator position, const value_ty ...