简体   繁体   English

如何在受SSH保护的Gitolite服务器上使用git clone

[英]How to use git clone with ssh protected gitolite server

I have set up gitolite on Azure Cloud according to these article: https://www.devbridge.com/articles/create-your-own-git-server-on-azure-cloud/ 我已经根据以下文章在Azure Cloud上设置了gitolite: https : //www.devbridge.com/articles/create-your-own-git-server-on-azure-cloud/

Now I want to clone the gitolite-admin repo, but I'm having problem with access. 现在,我想克隆gitolite-admin存储库,但是访问有问题。

My virtual machine is set up to allow for ssh2 connection and when I want to clone the gitolite-admin repo on my home computer (Windows) I need to provide the right key for it. 我的虚拟机已设置为允许ssh2连接,并且当我想在家用计算机(Windows)上克隆gitolite-admin存储库时,我需要为其提供正确的密钥。

When I type from git bash 当我从git bash键入时

git clone git@my-server:gitolite-admin 

I get 我懂了

Permission denied (publickey)

I think I'm little bit lost in these public-private keys. 我想我对这些公钥和私钥有点迷茫。

I've generated according to these key for my Azure VM http://azure.microsoft.com/pl-pl/documentation/articles/virtual-machines-linux-use-ssh-key/ 我已经根据这些密钥为我的Azure VM生成了http://azure.microsoft.com/pl-pl/documentation/articles/virtual-machines-linux-use-ssh-key/

Then I've uploaded admin.cer to my Azure 然后我已将admin.cer上传到我的Azure

I can connect with putty, filezilla, everything works. 我可以连接腻子,filezilla,一切正常。

I've generated admin.pub with puttygen and uploaded it to the server. 我已经用puttygen生成了admin.pub并将其上传到服务器。

Then I've done this 然后我就完成了

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

in order to make it work with gitolite. 为了使其与乙醇钠矿一起使用。

I've setup gitolite with these key and now I can't clone it. 我已经用这些键设置了gitolite,现在我无法克隆它。

I think I just need to hook up somehow my original private key to use with git clone but have no idea how. 我想我只需要以某种方式连接我的原始私钥以与git clone一起使用,但不知道如何使用。

I've already put all of these keys to my %HOMEPATH%/.shh/ folder but it doesn't worked. 我已经将所有这些键都放在了我的%HOMEPATH%/.shh/文件夹中,但是没有用。

I've even set up %HOME% = %HOMEPATH% as an enviromental variable in Windows. 我什至在Windows中将%HOME% = %HOMEPATH%为环境变量。

Now I'm truly lost with everything I've done. 现在我真的迷失了自己所做的一切。

I would say you need to do 2 things. 我会说你需要做两件事。

First, ensure that the properties on your .ssh directory and files in there are correct. 首先,请确保您的.ssh目录和其中的文件上的属性正确。 ssh is very picky about this ~/.ssh should be dwrx------, the private key should be -rw------, public key at least -rw-r--r--. ssh对此很挑剔~/.ssh应该是dwrx ------,私钥应该是-rw ------,公钥至少是-rw-r--r--。

The second one, is to make sure that you admin private key is presented when connecting to the the server. 第二个是确保连接到服务器时显示管理员私钥。 Since you didn't use a default key name, I would recommend to create a config file in .ssh that contains the following lines (defining a myserver alias): 由于您未使用默认键名,因此建议您在.ssh中创建一个包含以下行的config文件(定义myserver别名):

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

and try to clone using this alias with git clone myserver:gitoline-admin . 并尝试使用此别名与git clone myserver:gitoline-admin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM