git with apache, a push returns code 22

David Mehler dave.mehler at gmail.com
Fri Nov 8 18:16:47 UTC 2019


Hello,

I'm trying to run git on FreeBSD with Apache 2.4 as the web server. My
issue is I can pull/clone from the repo via remote:

git clone https://git.example.com/myrepo.git

This works fine. The issue comes when I atempt to push changes:

git commit -m "commit message"
git push origin master

This gives me an error message of can nnott access url return code 22.
The git and apache versions i'm using are:

apache24-2.4.41
git-2.24.0

They are installed from FreeBSD ports.
This previously was working, I'm wondering if an update has introduced
a new/incompatible change.
Here's my apache configuration:

# The git.example.com http virtual host
<VirtualHost *:80>
DocumentRoot /usr/local/www/git/repos
ServerName git.example.com
ServerAdmin webmaster at example.com
ErrorLog /var/log/git-httpd-error.log
CustomLog /var/log/git-httpd-access.log combined

<IfModule mod_rewrite.c>
RewriteEngine On
    RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
</IfModule>

# Completely deny pushing over HTTP
<LocationMatch "git-receive-pack">
Require all denied
</LocationMatch>
</VirtualHost>

# The git.example.com https virtual host
<VirtualHost *:443>
DocumentRoot /usr/local/www/git/repos
ServerName git.example.com
ServerAdmin webmaster at example.com
ErrorLog /var/log/git-httpd-error.log
CustomLog /var/log/git-httpd-access.log combined

# Uncomment the below 2 lines when deploy http2
H2Direct on
Protocols h2 h2c http/1.1

SSLEngine on
SSLCertificateFile "/usr/local/etc/ssl/acme.sh/example.com/fullchain.crt"
SSLCertificateKeyFile
"/usr/local/etc/ssl/acme.sh/example.com/private/server-ec256.key"
SSLCACertificateFile "/usr/local/etc/ssl/acme.sh/example.com/cacert.crt"

# HSTS (mod_headers is required) (15768000 seconds = 6 months)
Header always set Strict-Transport-Security "max-age=15768000"

<Directory "/usr/local/www/git/repos">
Options +ExecCGI
  SSLRequireSSL
AllowOverride None

AuthType Basic
AuthName "Private Git Access"
AuthUserFile "/usr/local/etc/apache24/git-auth-file"
AuthGroupFile "/usr/local/etc/apache24/git-htgroup-file"
Require valid-user
<If "%{QUERY_STRING} =~ m#service=git-receive-pack# || %{REQUEST_URI}
=~ m#/git-receive-pack$#">
Require group gitwrite
</If>
</Directory>

ScriptAlias /git /usr/local/libexec/git-core/git-http-backend
<Directory "/usr/local/libexec/git-core">
SetEnv GIT_PROJECT_ROOT /usr/local/www/git/repos
SetEnv GIT_HTTP_EXPORT_ALL
# For anonymous write
  #SetEnv REMOTE_USER anonymousweb
Options +ExecCGI
  SSLRequireSSL

AuthType Basic
AuthName "Private Git Access"
AuthUserFile "/usr/local/etc/apache24/git-auth-file"
AuthGroupFile "/usr/local/etc/apache24/git-htgroup-file"
Require valid-user
<If "%{QUERY_STRING} =~ m#service=git-receive-pack# || %{REQUEST_URI}
=~ m#/git-receive-pack$#">
Require group gitwrite
</If>
</Directory>

# gitweb
Alias /gitweb "/usr/local/www/gitweb"

<Directory "/usr/local/www/gitweb">
DirectoryIndex gitweb.cgi
Options ExecCGI
  SSLRequireSSL

AuthType Basic
AuthName "Private Gitweb Access"
AuthUserFile "/usr/local/etc/apache24/git-auth-file"
Require valid-user

<Files gitweb.cgi>
SetHandler cgi-script
</Files>
SetEnv  GITWEB_CONFIG  /usr/local/etc/gitweb.conf
</Directory>
</VirtualHost>

git-auth-file:
user:password

git-htgroup-file:
gitwrite: user

I am not getting anything in the apache log files.

Any ideas?
Thanks.
Dave.


More information about the freebsd-questions mailing list