root@ip123:/srv/git# dnf install httpd
python_pg.git。
root@ip123:/srv/git# vi /etc/httpd/conf.d/git.conf
<VirtualHost *:80>
ServerName deyu.wang
# Set environment variables for git-http-backend
SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL
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/libexec/git-core/git-http-backend/$1"
# Directory for the git-http-backend script
<Directory "/usr/libexec/git-core">
Options +ExecCGI
Require all granted
</Directory>
<Location "^/python_pg.git">
AuthType Basic
AuthName "Git Access"
AuthUserFile "/etc/httpd/conf.d/git.pyuser.htpasswd"
Require valid-user
</Location>
</VirtualHost>
python_pg.git 的用戶檔。
root@ip123:/srv/git# htpasswd -c /etc/httpd/conf.d/git.pyuser.htpasswd pyuser New password: Re-type new password: Adding password for user pyuser
root@ip123:/srv/git# systemctl enable --now httpd