![将本地 Windows git 存储库链接到 AWS Linux git 服务器](https://linux22.com/image/665727/%E5%B0%86%E6%9C%AC%E5%9C%B0%20Windows%20git%20%E5%AD%98%E5%82%A8%E5%BA%93%E9%93%BE%E6%8E%A5%E5%88%B0%20AWS%20Linux%20git%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我想在我的 aws linux 服务器上创建一个 git 服务器,这样每当我想在 public_html 中更新我的网站时,我不必手动将文件传输到服务器,我想利用 git,能够从我的本地机器将更改推送到远程服务器。
我已成功创建了一个裸 git 存储库,并创建了一个 post-receive 钩子来更新public_html
。这样,public_html
每当本地推送更改时,它都会更新。我现在无法将此存储库添加到我的本地Windows 机器。由于我使用的是 aws 实例,因此必须使用私钥 key.pem 来访问它(这就是使用 putty 访问它的方法)。我不知道如何将此存储库添加到我的本地计算机,同时还告诉 git 有关私钥的信息。
这是我所做的:
$> git remote add project_files ssh://[email protected]/~ec2-user/repo
在我尝试推动之后:
git push project_files +master:refs/heads/master
这是我得到的:
$> git push project_files +master:refs/heads/master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
我似乎无法解决这个错误。