好久没用git了,由于我前几天失误手抖把我项目删光了之后,我有重新开始用了……却发现我远程仓库???为什么传不上去!!!为什么报错!!!(。•́︿•̀。)
我以为github出问题了,然后我又试了一下gitee和coding,都这样……当然了,本仙女这么机智肯定找到了解决办法(*‘▽’*)♪
出现的问题(解决方法往后看)
Github 显示:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
coding 显示:
The authenticity of host ‘git.coding.net (118.25.166.124)’ can’t be established.
RSA key fingerprint is SHA256:jok3FH7q5LJ6qvE7iPNehBgXRw51ErE77S0Dn+Vg/Ik.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘git.coding.net,118.25.166.124’ (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
解决方法
最后搞来搞去是我太久没用了。我的SSH实效了,需要重新配置。
首先检查一下你电脑上SSH还在不在吧
gitbash输入ls ~/.ssh/
进行检查 id_rsa.pub 是否存在,如果存在,就不用生成一个新的SSH key了,继续往下看就OK了。如果不在,那就重新配置吧,SSH配置(github、coding、gitee都适用)
看了一下,我的还在,你输入命令行,如果在的话会出现文件名。
如果电脑上SSH
上边显示了我的SSH文件叫id_rsa.pub,去找这个文件,一般来说都在C:/user/用户名/.ssh文件夹下,找到之后用记事本打开id_rsa.pub,然后全选里面的东西复制。
转到github,用户设置那里找到SSH and GPG keys,点击新建,把你复制的粘贴进key那里,title随便填,不填也行,然后点击添加就OK。之后你就会收到成功添加的邮件。gitee、coding同理。