0

I have a server running Apache2 to serve git repositories.

The actual location of the repos is on a domain drive (which is backed up, etc.) - not a folder on the actual web server.

I can mount the domain drive on the web server and set owner/group, etc: if I put the mountpoint inside the webroot (like /var/www/html/domain_mount/) then I can refer to the repos by URL without issue.

However, because there is a lot of other things on the domain drive not related to the code, I'd like to just configure aliases (or symlinks) to the location of the git repos.

Ideally, I'd also like to have the domain drive mounted in the usual location for some uniformity (/media/username/domain_mount).

  1. Apache (or is it git?) doesn't serve the aliased git repos - how do I achieve this?

The Apache config has:

Alias /git/fa.git /var/www/html/git/domain_drive/path/to/repository.git

The error.log shows:

Not a git repository: '/var/www/html/git/fa.git'
  1. Once I have this working, I think it will be more obvious how to configure Apache to serve from outside the webroot ( directive?) - are there any gotchas to do with (1) I should take into account?

N.B. I've otherwise followed the general steps from here in configuring Apache:

https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP

http://www.codepool.biz/git-server-ssh-http-ubuntu.html

BugSpray
  • 113
  • 9
  • Do you have `Options FollowSymLinks` in apache config? – 1615903 Jul 17 '17 at 05:21
  • Yes - but the problems are mixed - if I use symlinks, I can get read (clone) but not write (push) with one error message. If I work with the aliases, I can only get read if the alias does not start with /git/, and I still can't get write access, but with a different error message. – BugSpray Jul 18 '17 at 01:36

1 Answers1

1

Ultimately I was able to get a working configuration using symlinks - which operates in both clone and push.

This person's post was very helpful:

How to set up git over http?

I also revisited the symlink option after enabling symlinks (reminder from @1615903 - thank you) and then did some troubleshooting on permissions.

The final piece to the puzzle was to mount the domain drive with both user and group set to Apache's.

I had previously just mount with the group set, going on the chgrp advice from the official git-scm manual. It seems this is not enough to get robust behaviour...

BugSpray
  • 113
  • 9