的.ssh配置与亚马逊EC2和Git [英] .ssh config with amazon ec2 and git

查看:314
本文介绍了的.ssh配置与亚马逊EC2和Git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,从Amazon EC2的服务器克隆一个Git仓库。它的工作原理没有在运行Ubuntu 12.04我的一台计算机的任何问题,而在另外一个使用12.10它给了我一个错误:

I have a strange problem with cloning a git repository from an amazon ec2 server. It works without any problems on one of my computers running ubuntu 12.04, while on another one using 12.10 it gives me an error:

ssh: Could not resolve hostname ec2server: Name or service not known  
fatal: The remote end hung up unexpectedly

这就像它不承认我的配置文件。我用下面的git的命令来克隆:

It's like it is not recognizing my config file. I use the following git command to clone :

sudo git clone ec2server:/var/www/project.git

sudo git clone ec2xxx.compute-1.amazonaws.com:/var/www/project.git

这两个配置文件是在两台计算机上相同,在〜/ SSH具有以下内容:

The two config files are identical on both computers, inside the ~./ssh with the following content:

Host ec2server
   Hostname ec2XXX.compute-1.amazonaws.com
   User ubuntu
   IdentityFile ~/.ssh/mykey.pem

如果我替换ec2server与实际地址,我得到了以下错误:

If I substitute the ec2server with the actual address I get the following error:

Cloning into 'project'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

在此先感谢。

Thanks in advance.

推荐答案

最近,我不得不重新安装的举办工作配置的系统,我还没有成功地复制它,所以它不是关于Linux版本(很可能)。我设法做的,就是我设法用所提到的原始脚本来克隆仓库到我的主目录。这捡起名称是否正确,但如果我导航到/无功/网络,我在做什么之前,它只是给了我同样的错误:可以ec2server没有发现......。所以我想这个问题需要做一些与+指令组合的权限。如果任何人都可以算出它如何使它工作,我将迎来他的反应是一个正确的答案,在此之前,我打我的是正确的,因为这是最接近正确的。

Recently I had to re-install the system which held the working configuration and I have not managed to replicate it, so it's not about the linux version (very likely). What I managed to do, is that I managed to use the mentioned original script to clone the repository into my home directory. Here it picked up the name correctly, but if I navigated into /var/www, what I was doing before, it just gave me the same error: could ec2server not found ... . So I figure the problem has to do something with the permissions + commands combination. If anyone can figure it out how to make it work, I will mark he's response as a correct answer, until then I am marking mine as the correct one, since this is the closest to the correct.

更新

我想通了什么问题:我不得不更改的/ var / WWW文件夹的权限,以便能够克隆到该目录中。现在是777(仅用于开发使用本地计算机上)。

I figured it out what was the problem: I had to change the permission on /var/www folder in order to be able to clone into that directory. Now it's 777 ( used only for dev on a local machine).

这篇关于的.ssh配置与亚马逊EC2和Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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