11. Create a key pair and make sure to save it somewhere safe. You won’t be able to replace it.
12. Launch the instance. Done!, Now we can ssh to this instance
__| __|_ ) _| ( / Amazon Linux AMI ___|\___|___|
https://aws.amazon.com/amazon-linux-ami/2016.09-release-notes/
chmod 400 key.pem
ssh -i key.pem ec2-user@x.x.x.x // get piblic ip of system
# exit from server now we are able to ssh to remote server
# now add local public key to server [Important step]
cat ~/.ssh/id_rsa.pub | ssh -i key.pem ec2-user@x.x.x.x "cat>> .ssh/authorized_keys"
ssh -i key.pem ec2-user@x.x.x.x
# enter to the remote system console
mkdir app.git
cd app.git
git init --bare
So not much going on here, all we do is create an empty repository and then leave. Now, on the local machine, you do something like the following:
Access remote repo :
.ssh > git clone ssh://ec2-user@x.x.x.x/home/ec2-user/app.git
Cloning into 'myproject'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
git:(master) git remote -v
origin ssh://ec2-user@x.x.x.x/home/ec2-user/app.git (fetch)
origin ssh://ec2-user@x.x.x.x/home/ec2-user/app.git (push)
Create POST Receive Hook
Crate POST receive push Hook
chmod +x hooks/post-receive