使用 ssh 克隆 [=10th=] 存储库

Cloning Git Repositroy using ssh

我正在尝试通过 ssh 在 Mac 上克隆一个 git 存储库。 到目前为止我遵循的步骤

  1. 已创建 id_rsa.pub 并与管理员共享 access.The 文件位于 /Users/admin/.ssh
  2. /Users/admin/.ssh 创建了一个 config 文件。文件内容为

    Host MY_DOMAIN
        IdentityFile ~/.ssh/id_rsa
        IdentitiesOnly yes
    
  3. 我在终端运行下面的命令

    git clone git@MY_DOMAIN:android.git     
    git clone git@MY_DOMAIN:android
    

我得到的回复是

Cloning into 'android'...
Enter passphrase for key '/Users/admin/.ssh/id_rsa': 
Connection to MY_DOMAIN closed by remote host.
fatal: Could not read from remote repository.

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

我有点困惑,如果我遵循正确的方法或者访问权限是否有任何问题。

您自己的用户帐户应该遵循前 2 个步骤,/Users/admin


根据您最近的编辑,看来问题不在于 git 配置,而在于您的 gitolite 设置。目前,您的 gitolite 实例只允许您访问一个存储库,即 testing,从以下输出可以清楚地看出:

hello onkar, this is git@m running gitolite3 v3.6.2-12-g1c61d57 on git 2.1.4

 R W    testing

配置您的 gitolite-admin 存储库并允许访问 android 项目。