I have set up a git repo on my amazon ec2 ubuntu server instance. I have been trying to push the code onto the server's repo from my local machine. The steps that I followed are:
ssh-add /path/to/myEC2publickey
On my EC2 Instance
mkdir /path/my_project.git
cd /path/my_project.git
git init --bare
Later on my localhost,
cd the_project
git init git add .
git commit -m "Initial git commit message"
git remote add origin username@hostname.com:the_project.git
git config --global remote.origin.receivepack "git receive-pack"
git push origin master
Since I was getting a Permission Deined (public key) error while executing the last command (i.e. git push origin master), I set the public key using the steps given on a forum that included -
ssh-keygen -t rsa -C "myemail@somedomain.com"
eval 'ssh-agent -s'
ssh-add
I was able to add the public key but I am still facing the Permission Denied (public key) : Error.
I'm new to git and have been looking forward to shift all my code into a git repo.
Any help would be greatly appreciated.