4

I am new to both Git and Amazon EC2.

I want to clone my Github code to Amazon EC2 directly.

For that I have referred to the following URLs:

http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/

http://deductiveblog.in/2013/05/19/deploy-to-amazon-ec2-using-git/

How to push to git on EC2

I've performed the necessary changes suggested in the above URLs, but am still not able to get my data on Amazon EC2.

By following the above suggested steps, I can see one directory - but it does not display the data in it that I have in git & in my local.

So what should I do to clone all data in Amazon EC2?

I also want to know one other thing - is it possible that I can put my files directly in /var/www directory without creating .git?

Now in this, I am getting an error Permission denied (publickey). Fatal the remote end hung up unexpectedly.

For that I have checked my ssh keys as well and add it to github. I have a file authorized_keys for key and I have added the same key in github, but still it gives me a Permission denied error.

Can anyone give any suggestions how to resolve this?

Community
  • 1
  • 1
Stan
  • 189
  • 8
  • 19
  • What git command have you used? What repo do you want to clone? What is the instance OS? What is the output of `git --version` when you are ssh'd into the ec2 instance? – jeremyjjbrown Feb 19 '14 at 14:23
  • Ubuntu is my instance OS. I Want to clone my Test Repo. When I use git --version command it gives me following output in my local pc: git version 1.8.4.msysgit.0. – Stan Feb 20 '14 at 04:29
  • So just clone the git repo to you ec2 instance. git-scm.com/docs/git-clone‎ – jeremyjjbrown Feb 20 '14 at 04:31
  • It would be appreciated if you provide me an example. – Stan Feb 20 '14 at 04:36

1 Answers1

2

You can just use the git clone command from your ec2 instance from the directory you want the repo cloned to.

git clone git://github.com/ryanb/railscasts-episodes.git

of course you need to alter the url part to your repo, this will create a folder with the files inside named after the repo in the current directory. If you want to clone the files inside the repo into the current directory do:

git clone git://github.com/ryanb/railscasts-episodes.git .

The Full Stop (.) or dot indicates the current directory in Unix.

jeremyjjbrown
  • 7,772
  • 5
  • 43
  • 55
  • Thanks jeremyjibrown it really helped me.. My problem is solved. I want to ask you one more questions that: Is it possible to clone all files without creating a Repository directory. I mean I want my files of Test repo outside the folder Test directly into /var/www folder as my site is running from there. – Stan Feb 20 '14 at 04:51
  • You can just clone from a directory outside /var/www , then if you want any files from your git repo to be served you can copy them or create symlinks. – jeremyjjbrown Feb 20 '14 at 15:13
  • I want my files in /var/www. Can you please share one example? It would be appreciated – Stan Feb 21 '14 at 04:25
  • Try using the . like above. – jeremyjjbrown Feb 21 '14 at 13:40
  • Yes, you are right. I have used . at the end of the command. But there is one condition that the current directory must be empty and I have another data in my /var/www directory and I want that data to be remain there and want to clone without folder so use of (.) can not resolve my problem. Can you suggest any other way? – Stan Feb 22 '14 at 03:21
  • Hey jeremyjjbrown I am getting an error like permission denied (public key). The remote end hung up unexpectedly. This error is not resolved. Can you help me out in this? – Stan Feb 25 '14 at 04:53
  • This error occurs while firing git clone git://github.com/ryanb/railscasts-episodes.git command. First it was working, but now it is giving me an error like permission denied (public key) fatal: remote end hung up unexpectedly. Any suggestions? – Stan Feb 25 '14 at 07:23
  • Hey I have solved my error by generating new SSH key for github and add it to Github account. Now it works for me. – Stan Feb 26 '14 at 07:19