klaussilveira / gitlist

An elegant and modern git repository viewer
https://gitlist.org/
BSD 3-Clause "New" or "Revised" License
2.92k stars 519 forks source link

default_repository_dir from config.yml don't work #925

Open dronmaxman opened 1 year ago

dronmaxman commented 1 year ago

My setup

Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Apache 2.4.54-1~deb11u1
php8.1 8.1.16+repack-1+0~20230214.36+debian11~1.gbpb38498

The settings file (config.yml) does not work.

I'm add ENV to .htaccess "SetEnv DEFAULT_REPOSITORY_DIR "/var/lib/git/repositories", after this gitlist start show name of only one repository from /var/lib/git/repositories. When I try to open the repository, I get an error 404.

In prod.log [2023-02-24T01:04:06.435503+02:00] request.INFO: Matched route "repository_list". {"route":"repository_list","route_parameters":{"_route":"repository_list","_controller":"GitList\\App\\Controller\\Repository::list"},"request_uri":"https://test- git.deps.kiev.ua/","method":"GET"} []

How to apply settings from config.yml?

supyrow commented 1 year ago

this is what i needed to do to get my domain to work. NOTE: i do not use the name gitlist, on my domain, this way i can use https://git.supyrow.com and not need to use git.supyrow.com/gitlist

.htaccess

<IfModule mod_rewrite.c>
    Options -MultiViews +FollowSymLinks
    RewriteEngine On
    #RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
        RewriteRule ^.*$ %2index.php [QSA,L]
    SetEnv default_repository_dir ../../repositories
</ifmodule>

apache2 config>>

gitlist.conf

Alias /gitlist /var/www/git.supyrow.com/public
Alias /assets /var/www/git.supyrow.com/public/assets
<Directory /var/www/git.supyrow.com/public>
  Options FollowSymLinks
  AllowOverride All
</Directory>
    LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error_gitlist.log
    CustomLog ${APACHE_LOG_DIR}/access_gitlist.log combined

setting default_repository_dir in config.yml seems to do nothing. so setting direct in .htaccess did the trick. this is relative from public/.

I use hosting24.com's webhosting service and another thing that needed to be done was remove due to an odd version of git running on the server.

--ignore-empty-lines from a line in src/SCM/System/Git/CommandLine.php

$output = $this->run(['show', '-w', '--ignore-empty-lines', '-b', '--cc', self::DEFAULT_COMMIT_FORMAT,

to

$output = $this->run(['show', '-w', '-b', '--cc', self::DEFAULT_COMMIT_FORMAT,

================================================================

disregard, the part about --ignore-empty-lines doesnt apply to you.

however, what worked for me. was to set up a folder just for , lets say

../../repositories

it needed to be relative and wouldn't work for me using a direct line to

/var/lib/git/repositories

have symlinks going to that directory. and it will find whatever is in there. (this is what I found to work.

also. PERMISSIONS. needs to be set for the user that runs the webserver. this line helped with that.

fatal: detected dubious ownership in repository at

sudo git config --system --add safe.directory /home/git/repositories/me/myrepo.git

i am using the zip 2.0.0 of gitlist

eriksejr commented 1 year ago

I think most of these issues may originate with how the cache is being handled here. The .php file which was importing the settings appears to be dynamically created in the cache with the values from config.yml the first time gitlist is run. If config.yml is changed after that point without the cache being cleared (rm -rf /var/cache) then any changes to this file do nothing at all and the user has no idea why.