我和gitolite一起来了.我在远程服务器上安装了gitolite.
http://dev.remoteserver.com
Run Code Online (Sandbox Code Playgroud)
所以我可以git-cloning gitolite-admin.git.
git clone ssh://gitolite@dev.remoteserver.com/gitolite-admin.git
Run Code Online (Sandbox Code Playgroud)
我想用gitolite添加用户和repo.以下是普通的添加用户进程.
在本地存储库中,存在conf/keydir目录.
open conf/gitolite.conf
Run Code Online (Sandbox Code Playgroud)
在文字下方添加.
repo aproject
RW+ = testid
Run Code Online (Sandbox Code Playgroud)
并且,在local-mac中,
ssh-keygen -t rsa.
Run Code Online (Sandbox Code Playgroud)
在keydir/testid.pub中添加了公钥,
然后git add/git commit/git push完成了.
好吧,然后我试图从远程服务器克隆新的git repo.
git clone ssh://testid@dev.remoteserver.com/aproject.git
Run Code Online (Sandbox Code Playgroud)
但是,它会像这样犯错误......
mac$ git clone ssh://testid@dev.remoteserver.com/aproject.git
Cloning into 'aproject'...
mac@dev.remoteserver.com's password:
Permission denied, please try again.
mac@dev.remoteserver.com's password:
Permission denied, please try again.
mac@dev.remoteserver.com's password:
Permission denied (publickey,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
我认为git克隆不应该问密码.和正确的密码也失败git克隆.
我的远程服务器是CentOS.
和评论欢迎.
使用gitolite,您使用用于安装的帐户完成所有ssh通信gitolite.
在你的情况下:gitolite.
但是,您可以指定其他公钥,以指示gitolite针对其他用户进行身份验证.
ssh会话仍将执行为gitolite.
但是传递给name gitolite脚本会testid(因为公钥被抢注gitolite在其~/.ssh/authorized_keys为' testid")
因此,请使用~testid/.ssh/config您提及正确参数的文件:
Host gitolitesrv
Hostname dev.remoteserver.com
User gitolite
IdentityFile /path/to/tesitd
Run Code Online (Sandbox Code Playgroud)
请注意,/path/to/必须包含您的私钥testid和公钥testid.pub.
在这一点上,他们的名字并不重要(可能是xxx和xxx.pub)
什么是重要的是存储在公共密钥的名称gitolite-admin/keydir/testid.pub(因为该文件的名称是用于记录在标识authorized_keys强制命令行)
然后,这git clone应该工作:
git clone gitolitesrv:aproject.git
Run Code Online (Sandbox Code Playgroud)
该OP Jinbom许提到有困难:
克隆到'aproject'...对于aproject的R访问DENIED到gitolite
(或者在给定的路径上可能没有存储库.你拼错了吗?)致命:远程端意外挂断
看来git的用户不是
testid,但gitolite.
Host dev2git
Hostname dev.remoteserver.com
User gitolite
IdentityFile ~/.ssh/testid
Run Code Online (Sandbox Code Playgroud)
并且
gitolite.conf文件包含以下内容(git-pushing):
repo aproject RW + = testid
最后,我找到了原因.
使用ssh-keygen生成ssh-key时,我输入了密码.那就是问题所在.
所以我尝试了没有密码的keygen,它的工作原理〜.我不知道为什么在我制作密钥时不应该添加密码.无论如何,它运作良好
我可以确认我一直使用无密码密钥.
我确实想用密码保护您的密钥,请参阅" 附录1:ssh守护程序要求输入密码 "
确保你被要求输入密码而不是密码短语.
不要混淆或误解提示输入密码'/home/sitaram/.ssh/id_rsa'的密码:来自远程服务器的密码提示!创建
ssh keypair使用时ssh-keygen,您可以选择使用密码来保护它.
当您随后使用它keypair来访问远程主机时,您的本地ssh客户端需要解锁相应的私钥,并ssh可能会询问您在创建时设置的密码keypair.每次尝试使用私钥时,有两种选择可以避免此提示.
- 第一种是创建没有密码短语的密钥对(只要在提示输入密码时按Enter键).
一旦一切正常,请务必在以后添加密码ssh-keygen -p.- 第二种是使用
ssh-agent(或keychain使用ssh-agent)或类似的东西来管理你的密钥.
除了讨论另外一个潜在的故障点ssh-agent(参见" 附录3:ssh客户端可能没有提供正确的密钥 "),进一步的讨论ssh-agent/keychain超出了本文档的范围.
| 归档时间: |
|
| 查看次数: |
4620 次 |
| 最近记录: |