Saturday, October 3, 2015

Git and Amazon EC2 public key denied

I had git working before on /var/html/projectfolder and realized it was a security risk so I made a new folder /projects from the root folder and tried to replicate what I did and now it doesnt work.



Here is the backlog of what I did for my local machine and EC2 - server




Server-EC2
1.I added my public key to the authorized_user file in ~/.ssh folder
2.Create a bare repository



git init --bare


3.Change folder permissions to



sudo chgrp -R ec2-user *

sudo chmod -R g+ws *


Local Machine




  1. create a local repository with git init

  2. touch, add, commit readme file

  3. pointed origin master to ec2 via




    git remote add origin ssh://ec2-user@remote-ip/path/to/folder




This is my output:



Permission Denied (publickey)
fatal: The remote end hung up unexpectedly

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...