无法推入gitolite-admin repo

时间:2012-08-09 11:37:46

标签: ssh gitolite

当我试图推动时,gitolite说

Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 339 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: 
remote:         ***** ABORTING *****
remote:         bad username me,
To ssh://git@githost-adm/gitolite-admin
   32cfc9f..41ee58f  master -> master

githost-adm在我的〜/ .ssh / config中描述为

Host githost-adm
HostName real.hostname.com
User git
IdentityFile ~/.ssh/gitolite-admin

私钥在ssh-agent中加载,因此当我想连接到gitolite-admin repo时,这使ssh能够使用特定的身份密钥。有类似的ssh别名githost-as-me包含另一个用于连接到其他repos的身份文件。

sshd日志似乎证明了pubkey已被接受

Accepted publickey for git from real.hostname.ip port 38916 ssh2

所以它可能位于gitolite内部错误隐藏的地方。

1 个答案:

答案 0 :(得分:0)

此错误消息来自src/lib/Gitolite/Conf/Store.pm

sub parse_users {
    my $users = shift;
    my @users = split ' ', $users;
    do { _die "bad username '$_'" unless $_ =~ $USERNAME_PATT }
      for @users;

    return @users;
}

使用:

$USERNAME_PATT        =  qr(^\@?[0-9a-zA-Z][-0-9a-zA-Z._\@+]*$);

当您从配置文件中存储您正在推送gitolite-admin repo的新用户时,由src/lib/Gitolite/Conf.pm调用。

} elsif ( $line =~ /^(-|C|R|RW\+?(?:C?D?|D?C?)M?) (.* )?= (.+)/ ) {
            my $perm  = $1;
            my @refs  = parse_refs( $2 || '' );
            my @users = parse_users($3);

请仔细检查您的配置文件语法(此处为documented for Gitolite V3, or 'g3':如果您仍在V2中,请检查this page)。
其中必定存在某种语法错误。

无论如何,这不是ssh问题