将一个本地的windows git仓库链接到aws linux git服务器

我想在我的aws linux服务器上创build一个git服务器,以便每当我想在public_html中更新我的网站时,我不必手动将文件传输到服务器,我想使用git,能够将更改推送到远程服务器从我的本地机器。

我已经成功创build了一个裸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. 

我似乎没有得到解决这个错误。