Host gitadmin.gammu.com
User git
IdentityFile /home/alvaro/.ssh/id_gitolite_mantra
Host git.gammu.com
User git
IdentityFile /home/alvaro/.ssh/id_alvaro_mantra
这是我的hosts文件的内容:
# Git
127.0.0.1 gitadmin.gammu.com
127.0.0.1 git.gammu.com
所以我应该能够通过这种方式与gitolite进行通信,以使用“普通”帐户访问:
$ssh git.gammu.com
通过管理员账户访问的方法如下:
$ssh gitadmin.gammu.com
当我尝试使用普通账户访问时,一切正常。
alvaro@mantra:~/.ssh$ ssh git.gammu.com
PTY allocation request failed on channel 0
hello alvaro, this is gitolite 2.2-1 (Debian) running on git 1.7.9.5
the gitolite config gives you the following access:
@R_ @W_ testing
Connection to git.gammu.com closed.
当我使用管理员账户进行相同操作时:
alvaro@mantra:~$ ssh gitadmin.gammu.com
PTY allocation request failed on channel 0
hello alvaro, this is gitolite 2.2-1 (Debian) running on git 1.7.9.5
the gitolite config gives you the following access:
@R_ @W_ testing
Connection to gitadmin.gammu.com closed.
应该显示管理存储库。如果我使用详细选项启动 SSH:
ssh -vvv gitadmin.gammu.com
...
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/alvaro/.ssh/id_alvaro_mantra (0x7f7cb6c0fbc0)
debug2: key: /home/alvaro/.ssh/id_gitolite_mantra (0x7f7cb6c044d0)
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/alvaro/.ssh/id_alvaro_mantra
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
...
它正在提供关键id_alvaro_mantra,而不应该!!
当我使用-i选项指定关键字时,情况也是一样的:
ssh -i /home/alvaro/.ssh/id_gitolite_mantra -vvv gitadmin.gammu.com
...
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/alvaro/.ssh/id_alvaro_mantra (0x7fa365237f90)
debug2: key: /home/alvaro/.ssh/id_gitolite_mantra (0x7fa365230550)
debug2: key: /home/alvaro/.ssh/id_gitolite_mantra (0x7fa365231050)
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/alvaro/.ssh/id_alvaro_mantra
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp 36:b1:43:36:af:4f:00:e5:e1:39:50:7e:07:80:14:26
debug3: sign_and_send_pubkey: RSA 36:b1:43:36:af:4f:00:e5:e1:39:50:7e:07:80:14:26
debug1: Authentication succeeded (publickey).
...
发生了什么事?我似乎错过了什么,但是找不到是什么。
这些是我的主目录的内容:
-rw-rw-r-- 1 alvaro alvaro 395 nov 14 18:00 authorized_keys
-rw-rw-r-- 1 alvaro alvaro 326 nov 21 10:21 config
-rw------- 1 alvaro alvaro 137 nov 20 20:26 environment
-rw------- 1 alvaro alvaro 1766 nov 20 21:41 id_alvaromaceda.es
-rw-r--r-- 1 alvaro alvaro 404 nov 20 21:41 id_alvaromaceda.es.pub
-rw------- 1 alvaro alvaro 1766 nov 14 17:59 id_alvaro_mantra
-rw-r--r-- 1 alvaro alvaro 395 nov 14 17:59 id_alvaro_mantra.pub
-rw------- 1 alvaro alvaro 771 nov 14 18:03 id_developer_mantra
-rw------- 1 alvaro alvaro 1679 nov 20 12:37 id_dos_pruebasgit
-rw-r--r-- 1 alvaro alvaro 395 nov 20 12:37 id_dos_pruebasgit.pub
-rw------- 1 alvaro alvaro 1679 nov 20 12:46 id_gitolite_mantra
-rw-r--r-- 1 alvaro alvaro 397 nov 20 12:46 id_gitolite_mantra.pub
-rw------- 1 alvaro alvaro 1675 nov 20 21:44 id_gitpruebas.es
-rw-r--r-- 1 alvaro alvaro 408 nov 20 21:44 id_gitpruebas.es.pub
-rw------- 1 alvaro alvaro 1679 nov 20 12:34 id_uno_pruebasgit
-rw-r--r-- 1 alvaro alvaro 395 nov 20 12:34 id_uno_pruebasgit.pub
-rw-r--r-- 1 alvaro alvaro 2434 nov 21 10:11 known_hosts
有一堆其他的键没有提供...为什么只提供了id_alvaro_mantra而不是其他的键呢?我无法理解。
我需要一些帮助,不知道该去哪里找....
主机 git.gammu.com用户 gitIdentityFile /home/alvaro/.ssh/id_alvaro_mantra IdentitiesOnly 是的 - Alvaro MacedaIdentitiesOnly yes添加到gitadmin.gammu.com和git.gammu.com的Host条目就足够了。您无需创建会影响其他主机的通配符条目。 - Bruno BronoskyHost * !bitbucket.org,参考https://superuser.com/a/859719/73736。 - ptim