I installed Git and Gitolite in a Amazon Instance EC2 according with the following steps :
Created a public key locally with and send it to the EC2:
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub /tmp/local.pub
rsync -avr /tmp/local.pub -e "ssh -i my-ec2-key.pem" root@xx.xx.xxx.xxx:/tmp/local.pub
Then installed the Git and gitolite :
sudo apt-get install git gitolite git-daemon-run
and then created a account for the user of git in EC2:
sudo adduser --system --shell /bin/bash --gecos 'git version control' --group --disabled-password --home /home/git git
su git
cd /home/git
echo "PATH=$HOME/bin:$PATH" > .bashrc
gl-setup /tmp/local.pub
When i tried to clone the repository from EC2 in a local machine with the following command it returned an error :
rui@rui:~/.ssh$ git clone git@ec2-xx-xxx-xx-xx.compute-1.amazonaws.com:testing.git
Cloning into 'testing'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried different approaches but in the end the error is the same.