更新时间:2022-10-31 18:26:17
那个错误信息来自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.