如何解决'无效的回购名称'Git错误? [英] How to solve 'invalid repo name' Git error?
问题描述
我已经安装了Gitolite,就像在GitLab说明中所说的那样,直到现在一切正常,创建了回购协议...但是当尝试克隆或推送时,它没有找到回购协议-或类似的东西.
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
那会是什么?
推荐答案
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
正在:
$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
,而是此处所述:
考虑
git@server:repositories/reponame.git
.
克隆操作将起作用-您正在使用完整的Unix路径(假定默认为$REPO_BASE
设置),因此shell会在您所说的位置找到存储库.
但是,当您进行推送时,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屋!