简体   繁体   English

将 git 服务器从 ssh 转换为 smart-http; ubuntu, apache; “不是 git 存储库”错误

[英]convert git server from ssh to smart-http; ubuntu, apache; "Not a git repository " error

I'm trying to convert a git repo from ssh access to smart-http access.我正在尝试将 git 存储库从 ssh 访问权限转换为智能 http 访问权限。 I've found all sorts of old, contradictory advice;我发现了各种古老的、相互矛盾的建议; the most recent being here .最近在这里

My client .git/config had the following URL originally:我的客户.git/config最初有以下 URL:

url = git@my-domain:/path-to-repos/my-project.git

I've changed that to:我已将其更改为:

url = https://my-domain/my-project.git

When I issue the command (works fine with the git@url above):当我发出命令时(适用于上面的 git@url):

git remote -v show origin

the apache server shows the following: apache 服务器显示如下:

==> error.log <==
Not a git repository: '/path-to-repos/my-project.git'
==> access.log <==
a.b.c.d - - [12/Mar/2022:05:47:19 +0000] "GET /my-project.git/info/refs?service=
git-upload-pack HTTP/1.1" 404 4851 "-" "git/2.30.0"

repos are set drwxrwx--- git www-data回购设置drwxrwx--- git www-data

apache has mod cgi , alias , env enabled apache 启用了 mod cgialiasenv

apache site config file has: apache 站点配置文件具有:

SetEnv GIT_PROJECT_ROOT /path-to-repos
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
ScriptAliasMatch \
    "(?x)^/(.*/(HEAD | \
    info/refs | \
    objects/(info/[^/]+ | \
    [0-9a-f]{2}/[0-9a-f]{38} | \
    pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
    git-(upload|receive)-pack))$" \
    "/usr/lib/git-core/git-http-backend/$1"
Alias /git /path-to-repos
<Directory /usr/lib/git-core>
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride None
    Require all granted

Any help would be much appreciated.任何帮助将非常感激。

I mentioned before that Alias /git... means the HTTPS URL will include /git .之前提到过Alias /git...意味着 HTTPS URL 将包含/git

But as in my old post, the issue is one of permission :但是就像我以前的帖子一样,问题是许可之一

cd /path/to/repo.git
sudo chgrp -R groupname .
sudo chmod -R g+rwX .
sudo find . -type d -exec chmod g+s '{}' +

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

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