I can successfully connect to my ec2 instance by ssh:
ssh -i amazon_ec2_123.pem ubuntu@xx.xx.xx.xxx
where xx.xx.xx.xxx
is my elastic ip address. Then I created a folder there called my_project.git
and ran git init --bare
in it.
Then I did this:
cat ~/.ssh/id_dsa.pub | ssh -i amazon_ec2_123.pem ubuntu@xx.xx.xx.xxx "cat >> .ssh/authorized_keys"
At my local machine from the projects' source directory I did this:
git remote add ec2 ssh://ubuntu@xx.xx.xx.xxx:/home/ubuntu/my_project.git
However, when I tried to push to the repo, I got the error:
ssh: Could not resolve hostname xx.xx.xx.xxx:: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What have I done wrong?