如何推与git的EC2 [英] How to push to git on EC2

查看:250
本文介绍了如何推与git的EC2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图按照<一个href="http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/">this指令。我有一个本地的git仓库,当我做一个混帐推,我需要回购推送到我的EC2实例。

I am trying to follow this instruction. I have a local git repo and when I do a git push, I need the repo to be pushed to my EC2 instance.

不过,在上面的教程,当我做了混帐推起源主,我得到权限被拒绝(公钥)错误,因为我没有指定的标识文件。

But, in the above tutorial, when I do a git push origin master, I get Permission denied (publickey) error because I did not specify the identity file.

说,我登录到EC2这样的:的ssh -i my_key.pem username@11.111.11.11

Say, I login to EC2 like this: ssh -i my_key.pem username@11.111.11.11

所以,我可以做类似这里的东西:混帐-i my_key.pem推动产地主或设置的标识文件 git的/配置

So, can I do something similar here to: git -i my_key.pem push origin master or set the identity file in .git/config

那么,我该怎么设置?

更新:混帐配置-l

user.name=my name
user.email=my_email_addreess@gmail.com
github.user=userid
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.url=ec2_id@my_e2_ip_address:express_app
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

更新(来自@乔恩的<一个href="http://stackoverflow.com/questions/4632749/how-to-push-to-git-on-ec2#comment5097220_4632766">comment):

Update (from @Jon's comment):

如果你有你的钥匙在一个奇怪的路径只需运行的ssh-添加/私营/按键/路径。这为我工作。

If you have your key in an odd path just run ssh-add /private/key/path. This worked for me.

推荐答案

要在本地SSH密钥复制到亚马逊尝试这种

To copy your local ssh key to amazon try this

cat ~/.ssh/id_dsa.pub | ssh -i amazon-generated-key.pem ec2-user@amazon-instance-public-dns "cat >> .ssh/authorized_keys"

替换过程中的关键和亚马逊EC2公共DNS的名称。

replacing the names of the key and amazon ec2 public dns, of course.

您将能够设置遥控器上亚马逊

you will then be able to setup your remote on amazon

这篇关于如何推与git的EC2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆