gpt4 book ai didi

amazon-ec2 - Amazon EC2 中的 Git 到本地机器

转载 作者:行者123 更新时间:2023-12-02 03:39:22 29 4
gpt4 key购买 nike

我按照以下步骤在亚马逊实例 EC2 中安装了 Git 和 Gitolite:

在本地创建公钥并将其发送到 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

然后安装 Git 和 gitolite :

sudo apt-get install git gitolite git-daemon-run

然后在EC2中为git用户创建了一个账号:

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

当我尝试使用以下命令从本地计算机的 EC2 克隆存储库时,它返回了一个错误:

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.

我尝试了不同的方法,但最终错误是一样的。

最佳答案

您可以查看一些内容:

  • gitolite-admin.git 存储库中的 gitolite.conf。确保内容是这样的。

    repo    gitolite-admin
    RW+ = rui

    repo testing
    RW+ = @all
  • 在 gitolite-admin.git 存储库的 gitolite-admin/keydir 目录中检查您的公钥文件是否存在。此外,它与您用于连接的文件的私钥相匹配。

我自己设置了 gitolite,对我来说效果很好。

关于amazon-ec2 - Amazon EC2 中的 Git 到本地机器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21141843/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com