github添加SSH Key
1.背景介绍
缘由:在github上下载goagent时出现错误。
在终端使用命令:git clone git@github.com:phuslu/goagent.git
会报权限错误如下:
Cloning into 'goagent'... The authenticity of host 'github.com (192.30.252.128)' can't be established. RSA key fingerprint is ::ac:a5:::2d:::1b::4d:eb:. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
2.原因及解决办法
使用git clone命令从github上同步github上的代码库时,如果使用SSH链接(如git clone git@github.com:phuslu/goagent.git),而你的SSH key没有添加到github帐号设置中,系统会报上面的错误。
(补充知识点:SSH key allows you to establish a secure connection between your computer and GitLab)
这时需要在本地创建SSH key,然后将生成的SSH key文件内容添加到github帐号上去。
3.解决问题的步骤
(1)To generate a new SSH key just open your terminal and use code below:
ssh-keygen -t rsa -C "你的邮箱"
会提示SSH key存储的路径(不能自己改路径?)
(2)获取SSH key:
生成的SSH key文件保存在中~/.ssh/id_rsa.pub文件中。
用文本编辑工具打开该文件,在linux下可以用cat命令显示id_rsa.pub中的内容(cat ~/.ssh/id_rsa.pub),然后复制其内容;如果在linux下,也可以直接使用记事本打开该文件,但一定要注意其内容中包含空格和换行,要将其去掉。
(3)接着拷贝.ssh/id_rsa.pub文件内的所以内容,将它粘帖到github帐号管理中的添加SSH key界面中:
进入https://github.com/settings/ssh,点击SSH Keys 》Add SSH Key,粘贴.ssh/id_rsa.pub文件内的所以内容,如下图:
此时,再使用SSH链接(如git clone git@github.com:phuslu/goagent.git),就可以成功clone了。
github添加SSH Key的更多相关文章
- 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时出现“Could not open a connection to your authentication agent”错误的应对方案(转)
在为windows 环境下的github账户添加SSH key时,需要在Git Bash执行如下命令: 第一步:检查已有的SSH keys $ ls -al ~/.ssh 第二步:生成新的SSH ke ...
- 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 ...
- windows系统如何添加ssh key到github
我自己的电脑安装了git后,从来没有用过,今天偶然用了一次,发现不能pull到东西,报错说我没有权限,于是我网上搜索了一下,应该是我没有配置ssh key的原因,相信很多人都有和我一样的经历吧,这里呢 ...
- github入门:设置添加ssh key<转>
GitHub是个分布式的版本控制库.github通过git使用,可以方便的记录代码版本. 通过github可以学习优秀的代码,可以改进提交其他项目中的bug,借助社区力量促进软件优化完善. 国内外大量 ...
随机推荐
- HDU1561 The more, The Better(树形DP)
题目是有n个存有宝藏的城堡,攻克任何一个城堡都需要先攻克0个或其他1个城堡,问攻克m个城堡最多能得到多少宝藏. 题目给的城堡形成一个森林,添加一个超级根把森林连在一起就是树了,那么就考虑用树型DP: ...
- windows下基于sublime text3的nodejs环境搭建
第一步:先安装sublime text3.详细教程可自行百度,这边不具体介绍了. 第二步.安装nodejs插件,有两种方式 第一种方式:直接下载https://github.com/tanepiper ...
- 【POJ】A New Stone Game(博弈论)
http://poj.org/problem?id=1740 题目大意就是,对于n堆石子,每堆若干个,两人轮流操作,每次操作分两步,第一步从某堆中去掉至少一个,第二步(可省略)把该堆剩余石子的一部分分 ...
- 关于sql语句的优化问题
系统要求进行SQL优化,对效率比较低的SQL进行优化,使其运行效率更高,其中要求对SQL中的部分in/not in修改为exists/not exists 修改方法如下: in的SQL语句 SELEC ...
- Pointcut is not well-formed: expecting 'identifier' at character position 0
异常如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDa ...
- Excel操作类
'引入Excel的COM组件 Imports System Imports System.Data Imports System.Configuration Imports System.Web Im ...
- java如何产生随机数
一.java如何产生随机数? 1.打开eclipse 2.新建java项目,例如取名为“suijishu”点击完成 3.新建一个类进行测试 4.首先要在头部插入一个包 输入import java.ut ...
- 单词游戏-基于SQLite+Qt的C++项目
SQLite文件数据库的操作 Qt插件的安装配置 1.VS2008下安装Qt开发包 解压缩4.7.3.rar到C:\Qt\4.7.3\ Qt for VS addin2.安装并配置Visual Ass ...
- 漫谈Java虚拟机(JVM)
Java 虚拟机(JVM)是可运行 Java 代码的假想计算机. 只要根据 JVM 规范描述将解释器移植到特定的计算机上,就能保证经过编译的任何 Java 代码能够在该系统上运行. 从上图中不难明白J ...
- POJ 1144 Network(Tarjan求割点)
Network Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12707 Accepted: 5835 Descript ...