简体   繁体   English

如何解决'无效的回购名称'Git错误?

[英]How to solve 'invalid repo name' Git error?

I've installed Gitolite, just like said in GitLab instructions, til now it was all ok, repo's created... but when tried to clone or push, it returns NO repo found - or something similar. 我已经安装了Gitolite,就像在GitLab说明中所说的那样,直到现在一切正常,创建了回购协议...但是当尝试克隆或推送时,它没有找到回购协议-或类似的东西。

But when I set my remote to the full path like git@server:22/~git/repositories/repo.git it clones, but when try to push, its caught an error: 但是当我将遥控器设置为git@server:22/~git/repositories/repo.git之类的完整路径时,它会克隆,但是当尝试推送时,它捕获了一个错误:

git push origin master
ERROR: invalid repo name.
fatal: The remote end hung up unexpectedly

What can it be? 会是什么

That error message comes from " gitolite-shell.parse_soc() " 该错误消息来自“ gitolite-shell.parse_soc()

sub parse_soc {
    my $soc = $ENV{SSH_ORIGINAL_COMMAND};
    $soc ||= 'info';

    my $git_commands = "git-upload-pack|git-receive-pack|git-upload-archive";
    if ( $soc =~ m(^($git_commands) '/?(.*?)(?:\.git(\d)?)?'$) ) {
        my ( $verb, $repo, $trace_level ) = ( $1, $2, $3 );
        $ENV{D} = $trace_level if $trace_level;
        _die "invalid repo name: '$repo'" if $repo !~ $REPONAME_PATT;
        trace( 2, "git command", $soc );
        return ( $verb, $repo );
    }

With REPONAME_PATT being: REPONAME_PATT为:

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

A gitolite address shouldn't include any path, like so: 一个gitolite地址不应包含任何路径,例如:

git@server:22/repo

Instead of git@server:22/~git/repositories/repo.git , this issue is described here : 而不是git@server:22/~git/repositories/repo.git这里描述了这个问题:

Consider git@server:repositories/reponame.git . 考虑git@server:repositories/reponame.git
The clone operation will work -- you're using the full Unix path, (assuming default $REPO_BASE setting), and so the shell finds the repo where you said it would be. 克隆操作将起作用-您正在使用完整的Unix路径(假设默认$REPO_BASE设置),因此shell会在您所说的位置找到存储库。
However, when you push, gitolite's update hook kicks in, and fails to run because some of the environment variables it is expecting are not present. 但是,当您进行推送时,gitolite的更新挂钩会启动,并且由于某些预期的环境变量不存在而无法运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM