2019-06-04 Github无法上传项目Permanent
2019-06-04 本文已影响0人
兣甅
遇到的问题大致如下:
Push failed
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
git@github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
明明其他github的项目都能提交代码和拉取代码,但是新项目死活上传不上去(没有用SSH的方式)
采用SSH的方式解决上传问题:
1.创建ssh相关文件
case@case-PC:~$ git config --global --list
...//验证邮箱
case@case-PC:~$ git config --global user.name case//设置全局用户名和邮箱
case@case-PC:~$ ssh-keygen -t rsa -C case@sina.com//生成秘钥,一路回车即可
...
case@case-PC:~$ cd /home/case/.ssh/
case@case-PC:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
2.找到id_rsa(最新github已经换成了id_rsa.pub)文件并打开,复制到github的setting->SSH and GPG keys ->SSH keys的New SSH key即可
3.上传到github
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/case/xxdemo.git
git push -u origin master