【问题标题】:How to use git clone with ssh protected gitolite server如何将 git clone 与 ssh 保护的 gitolite 服务器一起使用
【发布时间】:2015-06-01 02:24:17
【问题描述】:

我已经根据这些文章在 Azure Cloud 上设置了 gitolite:https://www.devbridge.com/articles/create-your-own-git-server-on-azure-cloud/

现在我想克隆 gitolite-admin 存储库,但我无法访问。

我的虚拟机设置为允许 ssh2 连接,当我想在我的家用计算机 (Windows) 上克隆 gitolite-admin 存储库时,我需要为其提供正确的密钥。

当我从 git bash 输入时

git clone git@my-server:gitolite-admin 

我明白了

Permission denied (publickey)

我想我对这些公私钥有点迷失了。

我已根据这些密钥为我的 Azure VM 生成 http://azure.microsoft.com/pl-pl/documentation/articles/virtual-machines-linux-use-ssh-key/

然后我已将 admin.cer 上传到我的 Azure

我可以连接 putty、filezilla,一切正常。

我已经用 puttygen 生成了 admin.pub 并上传到了服务器。

那么我已经做到了

ssh-keygen -i -f /tmp/ssh2/admin.pub > /tmp/openssh/admin.pub

为了使它与 gitolite 一起使用。

我已经用这些密钥设置了 gitolite,但现在我无法克隆它。

我想我只需要以某种方式连接我的原始私钥以与 git clone 一起使用,但不知道如何。

我已经将所有这些密钥放入了我的%HOMEPATH%/.shh/ 文件夹,但它不起作用。

我什至在 Windows 中将%HOME% = %HOMEPATH% 设置为环境变量。

现在我真的迷失了自己所做的一切。

【问题讨论】:

  • 我最终使用了 GitLab,所以没关系,但我仍然对公钥/私钥的事情感到困惑,我想现在更好,所以如果有人可以解释一下会好的。

标签: git ubuntu azure ssh gitolite


【解决方案1】:

我会说你需要做两件事。

首先,确保 .ssh 目录和其中文件的属性正确。 ssh 很挑剔这个~/.ssh 应该是dwrx------,私钥应该是-rw------,公钥至少是-rw-r--r--。

第二个是确保在连接到服务器时提供您的管理员私钥。由于您没有使用默认键名,我建议在 .ssh 中创建一个 config 文件,其中包含以下几行(定义 myserver 别名):

host myserver
user git
hostname my-server
IdentityFile ~/.ssh/admin

并尝试使用带有git clone myserver:gitoline-admin 的别名进行克隆。

【讨论】:

    猜你喜欢
    • 2012-09-10
    • 2011-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多