如何解决在homestead虚拟机中通过SSH Key 提交github失败报错!Permission denied (publickey)
先关联上远程的GitHub仓库,执行以下git 命令:git remote rm origingit remote add origin git@github.com:Eric-seven/sample.gitgit push origin master发现在homestead虚拟机中报以下错误:*Permission denied (publickey).fatal: C
·
先关联上远程的GitHub仓库,执行以下git 命令:
git remote rm origin
git remote add origin git@github.com:Eric-seven/sample.git
git push origin master
发现在homestead虚拟机中报以下错误:
*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 相关文件已经从本地电脑同步复制到对应的家目录下的.ssh文件夹中了。
然后将虚拟机中的SSH Key 添加到ssh-agent 中:
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
然后将本地主机中id_rsa.pub 公钥中的内容复制出来。
再到GitHub中添加一个新的 SSH Key
完成以上操作,再重新执行:
git push origin master
successfully!
参考链接:
github 上的参考
更多推荐
所有评论(0)