AWS EC2安装git服务器

时间:2018-12-07 06:31:02

标签: git amazon-web-services ubuntu

我尝试设置git服务器 AWS-EC2 AMI ubuntu-16.04 login-as:ubuntu

ubuntu@~$su
root@~#apt install git-core
root@~#adduser git
root@~#cd /
root@/#mkdir git
root@/#chmod 777 git
root@/#cd git 
root@/git#mkdir .ssh
root@/git#git init --bare test.git
root@/git#chown -R git:git test.git

客户端:Windows7 git

$ssh-keygen
$cat ~/.ssh/id_rsa.pub | ssh  ubuntu@public ip "cat >> /home/ubuntu/.ssh/authorized_keys"

服务器ubuntu-16.04 root @ /#cp /home/ubuntu/.ssh/authorized_keys /git/.ssh/authorized_keys

客户端:Windows7 git

$git clone git@public ip:/git/test.git
git@public ip: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

为什么? 我在VMware工作站ubuntu-16.04取得了成功 请帮我一下。谢谢

2 个答案:

答案 0 :(得分:0)

能否请您确认公共SSH密钥是否已与您的GIT帐户关联。您可以在git account

的个人资料设置下进行验证

答案 1 :(得分:0)

aws ec2 ubuntu-16.04 默认的普通帐户ubuntu成功了