Warning: Permanently added the RSA host key for IP address ‘192.30.252.131’ 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 key
解决方法如下
win+r cmd 回车
ssh-keygen -t rsa -C “lxw”//注意。lxw为用户名
如果执行成功。返回:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lxw/.ssh/id_rsa):
在这里就是设置存储地址了.反正我是直接按的回车
然后返回:
Enter passphrase (empty for no passphrase):
再次直接回车
Enter same passphrase again:
再次回车。
Your identification has been saved in /home/lxw/.ssh/id_rsa.
Your public key has been saved in /home/forwhat.cn/.ssh/id_rsa.pub.
The key fingerprint is:
我是一直回车
SSH key就生成了 就在电脑
将它粘帖到github帐号管理中的添加SSH key界面中。
还有一种方法
执行生成命令 : ssh-keygen
期间会提示你输入邮箱、密码(邮箱密码)直接输入就ok ,成功之后会在一个文件夹下生成一个私钥 id_rsa和一个公 钥 id_rsa.pub(放在服务器上)
我也没试 有兴趣的可以用下
git日常操作
git init 初始化文件夹为git管理
git clone 拉取远程代码
git status 查看文件工作区状态
git diff 查看修改 git diff filename 查看文件修改
git add . 添加所有修改文件到暂存区 git add filename 添加单个文件到暂存区
git commit -m"备注信息"
git push 推送到远程
git pull 拉取远程代码
git checkout -- filename 放弃工作区文件修改
git reset HEAD - filename 放弃暂存区(add)