GitServer: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 32: | Zeile 32: | ||
== Zugriff == | == Zugriff == | ||
* git clone git@git.f-r-e-i.de:/home/git/repo/example | * git clone git@git.f-r-e-i.de:/home/git/repo/example | ||
= GitWeb = | |||
<syntaxhighlight lang="bash"> | |||
apt install gitweb fcgiwrap | |||
DOMAIN=gitweb.hamatoma.de | |||
FN=/etc/nginx/sites-available/$DOMAIN | |||
test | |||
cat <<EOS >$FN | |||
server { | |||
listen 80; | |||
include snippets/letsencrypt.conf; | |||
server_name $DOMAIN; | |||
root /usr/share/gitweb; | |||
location / { | |||
return 301 https://$server_name$request_uri; # enforce https | |||
} | |||
} | |||
server { | |||
listen 443 ssl http2; | |||
ssl_certificate /etc/letsencrypt/live/latest/fullchain.pem; | |||
ssl_certificate_key /etc/letsencrypt/live/latest/privkey.pem; | |||
#ssl_certificate /etc/ssl/certs/$DOMAIN.pem; | |||
#ssl_certificate_key /etc/ssl/private/$DOMAIN.key; | |||
access_log /var/log/nginx/a_gitweb.log; | |||
error_log /var/log/nginx/e_gitweb.log; | |||
location /index.cgi { | |||
root /usr/share/gitweb/; | |||
include fastcgi_params; | |||
gzip off; | |||
fastcgi_param SCRIPT_NAME $uri; | |||
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf; | |||
fastcgi_pass unix:/var/run/fcgiwrap.socket; | |||
} | |||
location / { | |||
root /usr/share/gitweb/; | |||
index index.cgi; | |||
} | |||
} | |||
EOS | |||
ln -s ../sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN | |||
MkCert.sh $DOMAIN | |||
</syntaxhighlight> | |||
* /etc/gitweb.conf | |||
<pre> | |||
</pre> |
Version vom 10. Juni 2023, 02:30 Uhr
Initialisierung
adduser --shell /usr/bin/git-shell git
cd /home/git
mkdir .ssh
cd .ssh
touch authorized_keys
chown -R git.git /home/git
- /home/git/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Z4t...0blnUDBCr8AEZIj hm@ant ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH6ej...hrCjPpDy+U1L0W3 hm@mint18.fn.local
Leeres Repository einrichten:
mkdir /home/git/repo chown git.git /home/git/repo PROJ=example DIR=/home/git/repo/$PROJ.git mkdir $DIR cd $DIR git --bare init chown -R git.git $DIR
Zugriff
- git clone git@git.f-r-e-i.de:/home/git/repo/example
GitWeb
apt install gitweb fcgiwrap
DOMAIN=gitweb.hamatoma.de
FN=/etc/nginx/sites-available/$DOMAIN
test
cat <<EOS >$FN
server {
listen 80;
include snippets/letsencrypt.conf;
server_name $DOMAIN;
root /usr/share/gitweb;
location / {
return 301 https://$server_name$request_uri; # enforce https
}
}
server {
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/latest/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/latest/privkey.pem;
#ssl_certificate /etc/ssl/certs/$DOMAIN.pem;
#ssl_certificate_key /etc/ssl/private/$DOMAIN.key;
access_log /var/log/nginx/a_gitweb.log;
error_log /var/log/nginx/e_gitweb.log;
location /index.cgi {
root /usr/share/gitweb/;
include fastcgi_params;
gzip off;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location / {
root /usr/share/gitweb/;
index index.cgi;
}
}
EOS
ln -s ../sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN
MkCert.sh $DOMAIN
- /etc/gitweb.conf