git Permission denied, please try again.
博主在github上下载tiny face的的源代码的时候,遇到git clone命令为:git clone --recursive git@github.com:peiyunh/tiny.git
而当我在ternimal下执行这条语句的时候,出现错误:
Permissiondenied (publickey).
fatal:Could not read from remote repository.
Pleasemake sure you have the correct access rights
and the repository exists.
但是其实执行命令:git clone git@github.com:peiyunh/tiny.git 是没有问题的(不加--recursive参数),于是百度了一番,我理解的是原因是由于你在本地(或者服务器上)没有生成ssh key,你可以在ternimal下执行:
cd ~/.ssh ls来查看是否有文件id_rsa以及文件id_rsa.pub,如下图所示:(我的已经生成了,所以我ls后会显示。)

下面记录下解决办法:
1.首先,如果你没有ssh key的话,在ternimal下输入命令:ssh-keygen -t rsa -C "youremail@example.com", youremail@example.com改为自己的邮箱即可,途中会让你输入密码啥的,不需要管,一路回车即可,会生成你的ssh key。(如果重新生成的话会覆盖之前的ssh key。)

2.然后再ternimal下执行命令:
ssh -v git@github.com
最后两句会出现:
No more authentication methods to try.
Permission denied (publickey).
3.这时候再在ternimal下输入:
ssh-agent -s
然后会提示类似的信息:
SSH_AUTH_SOCK=/tmp/ssh-GTpABX1a05qH/agent.404; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13144; export SSH_AGENT_PID;
echo Agent pid 13144;
4.接着再输入:
ssh-add ~/.ssh/id_rsa
这时候应该会提示:
Identity added: ...(这里是一些ssh key文件路径的信息)
(注意)如果出现错误提示:
Could not open a connection to your authentication agent.
请执行命令:eval `ssh-agent -s`后继续执行命令 ssh-add ~/.ssh/id_rsa,这时候一般没问题啦。
5.打开你刚刚生成的id_rsa.pub,将里面的内容复制,进入你的github账号,在settings下,SSH and GPG keys下new SSH key,title随便取一个名字,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。
6.最后一步,验证Key
在ternimal下输入命令:
ssh -T git@github.com
提示:Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
这时候你的问题就解决啦,可以使用命令 git clone --recursive git@github.com:peiyunh/tiny.git 去下载你的代码啦。
git Permission denied, please try again.的更多相关文章
- Git permission denied(public key) 解决方法
1. 在Linux上: # ssh-keygen ##一定用 id_rsa.pub # cat /root/.ssh/id_rsa.pub 2. copy 整个文件内容到剪切板 3. 打开 ...
- git clone git@github.com:xxx.git Permission denied (publickey) 问题解决办法
From: https://www.cnblogs.com/restart/p/4633928.html 如果git无法通过普通的http去clone远程分支,可以选用ssh方式去连接.这时需要配置相 ...
- Git Permission denied (publickey).
有可能, jenkins slave service or jenkins service的logon 账户没有设置好
- git提交时报错 permission denied
git push 时报错:permission denied xxx 目前很多解决办法是生成公钥和秘钥,这种方法安全可靠,比较适用于一台电脑对应一个git账户,但是多个账户在同一台电脑上提交使用git ...
- centos: git clone提示Permission denied publickey 问题
问题: Initialized empty Git repository in /data1/mouxuan/fastsocket-private/.git/ Permission denied (p ...
- [pod install] error: cannot open .git/FETCH_HEAD: Permission denied
pod installAnalyzing dependencies[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permis ...
- ubuntu下git clone 出现Permission denied (publickey).
今天在ubuntu上使用git 克隆 github上面的库,一直权限拒绝Permission denied (publickey). 公钥绑了好几次,都不行: 最后怀疑是git配置公钥地址有问题:打开 ...
- windows python flask上传文件出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'的解决方法
在浏览器中输入时,出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads' http://127.0.0.1: ...
- 解决方案 git@github.com出现Permission denied (publickey)
ubentu 13.10 git version 1.8.3.2 解决方案:ssh -T git@github.com出现Permission denied (publickey).的问题 今天的任 ...
- git@github.com: Permission denied (publickey).////remote: Permission to xxx/test.git denied to xxx.等权限问题
Error msg git@github.com: Permission denied (publickey) 或者: remote: Permission to xxx/test.git denie ...
随机推荐
- 记录php遇到的那些坑
首先按照网上指南搭建php.阿帕奇.数据库环境. 具体放上网站 http://www.cnblogs.com/ypr-09-23/p/10797153.html 这是mysql安装指南 需要注意的是 ...
- js判断当值的比较小的背景为红色
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...
- 问题:配置apache的相关配置文件报错:Invalid command 'Order' (已解决)
1. 问题描述 在虚拟文件httpd-vhosts.conf里面,directory里加入Order allow,deny,重启apache,出现Invalid command 'Order', pe ...
- 作业一:PCA降维练习
作业一:PCA降维作业 代码 点击查看代码 #author:qiao_px #@Time 2022/10/31 16:11 #@File ceshiPCA.py import pandas as pd ...
- Spectracom 默认口令
网络空间搜索: FoFa 找到页面: 默认口令 在github上去找 登陆成功 End!!!
- AD9834配置
SPI设置 注意,虽然手册上CPOL(CLK空闲时电平)为低,但实测是是高电平 连接 SYNC 为片选引脚,使用时拉低 FSE/PSE为频率与相位寄存器选择,均拉低即可 void SPI_Write_ ...
- mysql 正则匹配不规则日期
where colum4 REGEXP "^[[:digit:]]{1}/[[:digit:]]{1}/[[:digit:]]{4}"=1 -- 2/3/2021 wher ...
- 【已解决】xlwings库合并单元格,不报错,不执行
源代码如下: import xlwings as xw app = xw.App(visible=True, add_book=False) app.display_alerts = False ap ...
- React之一个组件的诞生
此处以input组件为例 input.js import React from 'react' class Input extends React.Component { // ps:使用static ...
- Array 方法总结
会改变自身的方法: 返回新数组的长度,改变原数组 1.push 2.pop 3.shift 4.unshif 返回新数组,改变原数组 5.reverse 6.sort 按字符串在字典中的顺序排序 自定 ...