我刚刚在debian上设置了一个git + Gitolite服务器,在我的工作站(Windows)上用puttygen生成了一对密钥,并在服务器上注册了第一个pub密钥
gitosis setup -pk firstuser.pub然后我使用TortoiseGit克隆gitolite admin,使用url :git@git.myserv.com:gitolite和Tortoise使用firstuser.ppk作为私钥。在此之前一切都很顺利。
然后,我想测试添加一个用户并在我的工作站上创建一个新的回购程序。
我在conf文件中添加了一个节:
repo testcreation
RW+ = seconduser我在工作站上为第二个用户生成第二个ssh密钥对。只需将seconduser.pub放入keydir/ commit并按下新配置即可。
配置seam是好的,我的新用户发布键添加到服务器端git用户的~/..ssh/authorized_ key中。
我和乌龟在工作站上安装了一个新的遥控器,添加了一个新的遥控器:
name : origin
url : git@git.myserv.com:testcreation
Putty Key : seconduser.ppk然后推动创建回购
TortoiseGit Log :
git.exe push --all --progress "origin"
FATAL: W any testcreation firstuser DENIED by fallthru
(or you mis-spelled the reponame)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
git did not exit cleanly (exit code 128) (1591 ms @ 12/02/2014 12:20:17)为什么当我发送感应器私钥时,Gitolite将我识别为第一个用户?这与我在同一个工作站上使用两个不同的键有关吗?
发布于 2014-02-12 14:09:39
我找到了解决我的问题的方法。
注意,我的工作站在Windows下
事实上,TortoiseGit不是使用OpenSSH作为SSH客户端,而是使用Putty。在我的例子中,这真的很麻烦,因为TortoiseGit与Plink ( putty ) 不能使用putty作为ssh客户端来处理两个私钥来验证来自同一个工作站的两个不同的Gitolite用户到一个用户@主机(在我的例子中是第一个用户和第二个用户)。
请注意,在现实生活中,您可能不需要在同一个工作站上使用两个不同的ssh身份验证,我只需要做‘测试’。
问题是,据我所见,每个用户@主机(git@git.myserv.com)注册一个密钥,我需要两个密钥.我在使用%HOMEDRIVE%%HOMEPATH%\.ssh\config中的ssh文件使用git (和openSSH)后发现了
这是我的配置:
Host gitfirstuser
HostName git.myserv.com
User git
IdentityFile ~/.ssh/firstuser@git.myserv.com
Host gitseconduser
HostName git.myserv.com
User git
IdentityFile ~/.ssh/seconduser@git.myserv.com其中firstuser@git.myserv.com和seconduser@git.myserv.com是OpenSSH密钥格式的私钥文件
在此之后,我可以毫不费力地使用testcreation.git克隆git bash。
git clone gitseconduser:testcreation所以推,拉等..。
但是,当您有一些GUI爱好者时,git只是一个噩梦,所以下面是TortoiseGit中的解决方案,让它使用一个真正的ssh客户机:
打开TortoiseGit设置:
> Network section > SSH Client input > Browse...在msysgit安装目录中查找ssh.exe,在我的例子中:
C:\Program Files\Git\bin\ssh.exe一旦将ssh客户端更改为ssh.exe,就可以充分利用ssh配置文件。
例如:
在你的%HOMEDRIVE%%HOMEPATH%\.ssh\config里
Host ssh_host_1
HostName git.myserv.com
User git
IdentityFile ~/.ssh/ssh_host_1_keyfile在TortoiseGit中,添加远程或克隆时使用以下url:
ssh_host_1:repository_name不需要查找私钥文件,openssh将根据ssh_host_1部分进行标识
https://stackoverflow.com/questions/21726745
复制相似问题