在输入如下命令
git add test.txt
git commit -m"modify record..."
git push -u origin master
之后,出现没有权限的提示
Warning: Permanently added the RSA host key for IP address '172.16.xxx.xxx' to the list of known hosts. Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因是没有在自己的github上添加公钥,可以通过如下命令验证:
解决方法如下,先生成密钥:
ssh-keygen -t rsa -C"ring04w"
可以知道公钥目录/Users/ring04w/.ssh/id_rsa.pub,一路enter下去
然后,通过cat 命令将key显示出来,再将其添加到github上。
个人账号---Settings--- SSH and GPG keys--New SSH key---复制进去,add,确定就可以了。
删除命令 git rm -r test.txt