问题:
[email protected]: Permission denied (publickey). Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
重装电脑后在远端的SSH KEY 和本地端的SSH KEY对不上 所以当前
解决方法:
当我们使用github或者bitbucket等仓库时我们有可能需要ssh认证,所以需要生成他的ssh key。
1、首先你要安装Git工具
下载地址:https://git-scm.com/downloads
2、右键鼠标,选中 “git Bash here”,当然你也可以在windows的 “开始”--->“所以程序”,或者安装目录打开它
3、输入指令,进入.ssh文件夹
cd ~/.ssh/
如果提示 “ No such file or directory”,你可以手动的创建一个 .ssh文件夹即可
命令为:
mkdir ~/.ssh
4、配置全局的name和email,这里是的你github或者bitbucket的name和email
git config --global user.name "xkwg" git config --global user.email "[email protected]"
5、生成key
ssh-keygen -t rsa -C "[email protected]"
连续按三次回车,这里设置的密码就为空了,并且创建了key。
Your identification has been saved in /User/Admin/.ssh/id_rsa.
Your public key has been saved in /User/Admin/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub
如果上面的步骤之前已经做过了,那现在就只需要
6、打开Admin目录进入.ssh文件夹,用记事本打开id_rsa.pub,复制里面的内容添加到你github或者bitbucket ssh设置里即可
全部复制
这是bitbucket的添加key,点击右上方的头像,选择设置,然后
这是github添加key
7、测试是否添加成功
bitbucket输入命令:
ssh -T [email protected]
提示:“You can use git or hg to connect to Bitbucket. Shell access is disabled.” 说明添加成功了
github输入命令:
ssh [email protected]
提示:“Hi lsyz0021! You've successfully authenticated, but GitHub does not provide shel l access.”说明添加成功。
标签:bitbucket,git,仓库,汇总,rsa,github,ssh,key From: https://www.cnblogs.com/chenxiaomeng/p/17476884.html