1

I'm trying to convert a git repo from ssh access to smart-http access. I've found all sorts of old, contradictory advice; the most recent being here.

My client .git/config had the following URL originally:

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 remote -v show origin

the apache server shows the following:

==> 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

apache has mod cgi, alias, env enabled

apache site config file has:

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Gary Aitken
  • 233
  • 2
  • 12
  • The URL might be https://my-domain/git/my-project.git? – Martin Zeitler Mar 12 '22 at 06:26
  • unfortunately, just changes the error: Not a git repository: '/path-to-repos/git/my-project.git' – Gary Aitken Mar 12 '22 at 17:00
  • Ugh. My mistake. The main repo directory had the wrong permissions. Probably because I did the chgrp from the repo itself, not its parent. I would have bet money I checked that, but apparently only checked the ones below. – Gary Aitken Mar 12 '22 at 17:07

1 Answers1

0

I mentioned before that Alias /git ... means the HTTPS URL will include /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 '{}' +
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, my fingers hit '*' instead of '.', and I forgot to check the root dir when investigating, as mentioned above. I've got a followup problem but will post a new question, as the subject is different. – Gary Aitken Mar 13 '22 at 16:17