如何使用 SSH 将我的存储库推送到 Github?
为什么
我想在我的 PHP 期间将我的存储库托管在 GitHub 上 学习。
我做了什么
我将 kaede0902/php
的远程 url 设置为 htdocs/workspace
,
并试图 pull 。我用了须藤。
错误信息
kaede@kaede-ThinkPad-T450:/opt/lampp/htdocs/workspace$ sudo git pull origin master
Warning: Permanently added the RSA host key for IP address '52.69.186.44' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我的 ssh url 是 git@github.com:kaede0902/php.git
。
我正在为其他存储库使用 ssh 连接。
问题是什么?
最佳答案
您必须将您的 ssh key 添加到两台机器。
这个错误意味着你的机器上没有ssh。
您可以从您的任何机器复制现有的一个或创建一个新的。
创建和添加 ssh key
来源:https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account
生成ssh key
打开 Git Bash。
运行
ssh-keygen
并按照屏幕上的消息进行操作(或者只需单击 Enter 直到结束)复制 key 文件(公钥的内容)位于:
~/.ssh/id_rsa.pub
将 key 添加到Github
关于php - 如何使用 SSH 将我的存储库推送到 GitHub?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57971890/