如何解决“无效的仓库名称"Git 错误? [英] How to solve 'invalid repo name' Git error?

查看:23
本文介绍了如何解决“无效的仓库名称"Git 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Gitolite,就像 GitLab 说明中所说的那样,到目前为止一切正常,repo 已创建...但是当尝试克隆或推送时,它返回 NO repo found - 或类似的东西.

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.

但是当我将远程设置为完整路径时,例如 git@server:22/~git/repositories/repo.git 它会克隆,但是当尝试推送时,它会遇到错误:

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 push origin master
ERROR: invalid repo name.
fatal: The remote end hung up unexpectedly

会是什么?

推荐答案

那个错误信息来自gitolite-shell.parse_soc()"

That error message comes from "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 );
    }

使用 REPONAME_PATT 存在:

With REPONAME_PATT being:

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

gitolite 地址不应包含任何路径,如下所示:

A gitolite address shouldn't include any path, like so:

git@server:22/repo

这个问题不是 git@server:22/~git/repositories/repo.git,而是 这里描述:

Instead of git@server:22/~git/repositories/repo.git, this issue is described here:

考虑 git@server:repositories/reponame.git.
克隆操作将起作用——您使用的是完整的 Unix 路径(假设默认的 $REPO_BASE 设置),因此 shell 会在您所说的位置找到 repo.
但是,当您推送时,gitolite 的更新钩子会启动,并且由于它所期望的某些环境变量不存在而无法运行.

Consider 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.
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.

这篇关于如何解决“无效的仓库名称"Git 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆