【发布时间】:2025-12-04 04:50:01
【问题描述】:
我正在尝试将我的私有 github 存储库克隆到我的 EC2 实例,但似乎我采取了错误的步骤来允许 Github 连接到 EC2 实例。在我在路径 /var/www/app 创建的文件夹中运行 git clone git@github.com:username/repo.git 时,我被告知要对 Githbuc.com 主机进行身份验证并提供两个 RSA 密钥指纹(我假设是我的仓库中的那些),然后向我发送一个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在运行 git clone 命令之前,我将在 .pem 中找到的 SSH 密钥复制到我的 Github SSH 密钥。这些 EC2 凭证是我用来通过 SSH 连接到实例的凭证。这是使用错误的密钥吗?我知道 EC2 实例也有在 .ssh/authorized_keys 中找到的公钥,但我觉得这些与用于通过 SSH 连接到实例的公钥相同。
我错过了一步吗?我需要在我的/var/www/app 目录中初始化git 或在git clone 命令之前配置任何东西吗?
任何帮助都会很棒。谢谢!
【问题讨论】:
标签: git github amazon-ec2 ssh