前两天自己写了一个食品商城的项目,提交至GitHub遇到了一个小小的绊脚石。
看一眼error
git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.每次初始化的时候都是正常运作的,一到push出现了问题
简单看了下错误,发现问题在于前几天换了个系统,Git重装之后没有配置ssh,重头到尾搞一遍下载ssh-keygen
一路回车即可,去找生成的keygen文件 C:\用户\你的用户名\.ssh\id_rsa.pub 把内容全部复制
回到GitHub
1.设置
2. 找到ssh
3.创建
4.完成 (tittle为keygen)
如果还存在问题考虑一下,账户名和邮箱是否正确.
重新设置一下账户名和密码
$ git config --global user.name "账户名"
$ git config --global user.email "邮箱"
完成
是时候起飞上传代码了