git push 报错
报错信息:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
应该是ssh key 过期了或者没了,登录github看了一下是ssh key没了,所以重新生成一个添加到github就行了。
在控制台,执行
ssh-keygen -t ed25519 -C "your_email@example.com"
然后会提示
Enter file in which to save the key
可以直接回车使用默认目录或者填一个目录,接着会出现输入密码的提示,直接回车不填,或者设置一个密码(之后push代码的时候会需要)
Enter passphrase (empty for no passphrase):
确认密码
Enter same passphrase again:
这样就生成了一个新的ssh key,在控制台输入
pbcopy < ~/.ssh/id_ed25519.pub
将这个key复制到剪切板,再去github添加这个key,重新push,就行了。但是我的ssh key怎么会没了呢???