【问题标题】:Gitosis publickey permission deniedGitosis 公钥权限被拒绝
【发布时间】:2012-02-21 06:31:41
【问题描述】:

我有一个 gitosis 服务器在工作,我也将 github 用于个人项目,我试图为两个帐户使用相同的公共和私有 ssh 密钥,唯一的区别是 gitosis 中的用户名是 md.mercado49 和在 github 中是 maumercado。

我已经将我的公钥上传到了 gitosis,当然我在 github 上已经有一段时间了,现在的问题是我在尝试连接到 gitosis 服务器时权限被拒绝,但是在使用 github 连接到 github 时它成功了相同的键。

这是我使用 ssh -vT gitosis@repocomit.virtual.uniandes.edu.co 命令得到的结果:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to repocomit.virtual.uniandes.edu.co [157.253.238.144] port 22.
debug1: Connection established.
debug1: identity file /Users/maumercado/.ssh/id_rsa type 1
debug1: identity file /Users/maumercado/.ssh/id_rsa-cert type -1
debug1: identity file /Users/maumercado/.ssh/id_dsa type -1
debug1: identity file /Users/maumercado/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'repocomit.virtual.uniandes.edu.co' is known and matches the RSA host key.
debug1: Found key in /Users/maumercado/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/maumercado/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/maumercado/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

是否有可能做我想做的事,使用相同的密钥和不同的用户名和电子邮件进行身份验证?

我应该为其他帐户生成不同的密钥吗?如果可以,如何?

感谢大家的帮助!

...另外,我相信无关紧要,但谁知道呢,我用 github 信息设置了 git global config,但是在我有 git config --local 的公司的项目上...这应该没问题吧?

==== 更新 ====

所以我在调试部分注意到以下内容:

debug1: Offering RSA public key: /Users/maumercado/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/maumercado/.ssh/id_dsa

为什么在它实际上是私钥的情况下将 id_rsa 作为我的公钥,而在我的私钥甚至不存在时将 id_dsa 作为我的私钥?

【问题讨论】:

    标签: git ssh github redmine gitosis


    【解决方案1】:

    对于您使用公共 ssh 密钥的频率和位置没有限制。键中的名称更多用于文档目的。只要系统支持密钥类型(RSA/DSA)即可。

    gitosis 曾经使用过您的密钥吗?配置有点棘手。还要确保它的密钥文件中没有换行符。

    关于您的 git config 问题:本地设置覆盖全局设置。但这就是你这样做的方式。

    【讨论】:

    • 你好@iltempo,实际上仍然是同样的问题,gitosis 服务器密钥是一个 dsa。我在 redmine-gitosis 插件 Public Keys 中检查了我的密钥,里面没有什么奇怪的东西,比如空格或任何东西!
    • 我不知道 redmine 对 gitosis 做了什么。你可以发布你的配置吗?
    • 你想让我给你哪个文件...或者你说的是redmine中的插件配置,如果是这里->cl.ly/072e14363L0G2R1g2v46
    • 还需要配置文件吗??或者可能需要进一步测试?
    • 看了一下截图。您在哪里设置允许您的 ssh 密钥 /Users/maumercado/.ssh/id_dsa 访问 gitosis 服务器上的存储库?
    【解决方案2】:

    经过漫长的调试时间,思考和分析,我在http://dev.remarkablewit.com/redmine/projects/dev-server/wiki 之后重新做了所有事情,它工作,至少对我来说,也在我在 [gitosis] loglevel=DEBUG 下添加的 gitosis.conf 中帮助我解决了一个问题多一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-11
      • 2019-11-24
      • 2014-11-08
      • 2012-01-18
      • 2012-04-25
      • 2014-03-18
      • 2023-03-22
      相关资源
      最近更新 更多