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,借助社区力量促进软件优化完善. 国内外大量 ...
随机推荐
- LightOJ1025 The Specials Menu(区间DP)
给一个字符串,问有几种删字符的方式使删后的非空字符串是个回文串. 当然区间DP:dp[i][j]表示子串stri...strj的方案数 感觉不好转移,可能重复算了.我手算了"AAA" ...
- 坑爹的strcat
strcat是会改变原来的字符型数组的值的. #include<stdio.h> #include<stdlib.h> #include<string.h> voi ...
- Linux redirect the stdout to a file
1: int save_out = dup(fileno(stdout));//backup stdout 2: int out = open("cout.log", O_RD ...
- PHP中常见的页面跳转方法
转载自冠威博客 [ http://www.guanwei.org/ ]本文链接地址:http://www.guanwei.org/post/PHPnotes/04/php-redirect-metho ...
- [leetCode][003] Intersection of Two Linked Lists
[题目]: Write a program to find the node at which the intersection of two singly linked lists begins. ...
- TYVJ P1013 找啊找啊找GF Label:动态规划
做题记录:2016-08-15 22:19:04 背景 MM七夕模拟赛 描述 "找啊找啊找GF,找到一个好GF,吃顿饭啊拉拉手,你是我的好GF.再见.""诶,别再见啊.. ...
- COJ 删除数字
试题描述 输入正整数N和M,在N中删除掉M位,能留下的最大整数是多少? 输入 正整数N和M 输出 留下的最大整数 输入示例 233390323 5 输出示例 9323 其他说明 1<=N< ...
- java不用jni,也可以获得当前系统性能信息
最近做个项目,就是要取得cpu占有率等等的系统信息,一开始以为要用动态链接库了,但后来发现可以像下面这样做,不去调用jni,这样省去了很多看新技术的时间o(∩_∩)o... 在Java中,可以获得总的 ...
- 用C语言实现素数筛法获取一亿(100000000)以内的全部素数
具体筛法是:先把n个自然数按次序排列起来.1不是质数,也不是合数,要划去.第二个数2是质数留下来,而把2后面所有能被2整除的数都划去.2后面第一个没划去的数是3,把3留下,再把3后面所有能被3整除的数 ...
- 【转】SQLServer内部原理
原文地址:http://twb.iteye.com/blog/182083 在讲SQLSERVER内部原理的之前,我觉得非常有必要向大家介绍一下SQLSERVER的历史. 让我们站在1999年,看看计 ...