I have a DigitalOcean droplet with Centos 7 but I can't see my repos on my droplet.
I have a user git
and inside the respective home folder I have the folder "projects": /home/git/projects
Inside that folder is a test repo initialized with: git init --bare
Here is my gitweb.conf
$projectroot = "/home/git/projects";
$git_temp = "/tmp";
$home_link = $my_uri || "/";
$home_text = "indextext.html";
$projects_list = $projectroot;
Here my sites-availables file:
server {
listen 80;
server_name git.apselom.com;
access_log /var/log/nginx/git.apselom.com.access_log main;
error_log /var/log/nginx/git.apselom.com.error_log info;
location /gitweb.cgi {
root /var/www/git/;
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 /var/www/git/;
index gitweb.cgi;
}
}
With those, I only get the error: 404 - No projects found
.
I suspect the problem is that the user your web server is running as is unable to access your git repositories.
What's odd is that you said you're using CentOS 7, but CentOS 7 ships with Apache httpd, and what you have their looks like a Lighttpd configuration. The gitweb
package for CentOS ships with an Apache configuration file, so that using it is basically:
Install the package(s):
yum install gitweb httpd
Create your git
user and make sure the apache
user will be able to access things:
# useradd -c 'git user' git
# usermod -a -G git apache
# su - git <<EOF
mkdir projects
git init --bare projects/project1
git init --bare projects/project2
EOF
# chmod -R g+rwX /home/git
Edit /etc/gitweb.conf
to point to the projects directory:
our $projectroot = "/home/git/projects";
Start the web server:
systemctl enable httpd
systemctl start httpd
And you're good to go:
$ links http://localhost/git/
[...]
Project Description Owner Last Change
project1 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
project2 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
The key part, though, is ensuring that your web server has appropriate permissions on your /home/git
directory. If you're not using Apache, figure out what user your web server is using and then substitute that in the above.