Git Codebase - Sn0wlink IT
Git Codebase

Code: Download ZIP



README

Dynamic PHP Git Repository Browser

Release: Version 1.0

Demo Screenshot

A lightweight, zero‑dependency PHP-based Git repository viewer that dynamically lists and displays repositories, directories, files, and README.md content from a given document root.

Designed for self-hosters who want a simple, fast, no‑JavaScript viewer for local or server‑side Git repositories.

Features

Project Structure

The application is fully contained in a single index.php file:

Requirements

Usage

  1. Drop index.php into your document root.
  2. Ensure subdirectories are Git repositories.
  3. Open in a browser:
http://your-server/index.php

The script will automatically:

Generating ZIP Archives

There is a zip_dir.sh file in the assets folder. Place this next to the index.php file (root directory) and run. This will then take all of the repos and compress them to zip files. Once run the 'Download Zip' button will appear on the Web UI for that repo. You can also generate the zip manually making sure to call the zip file the same as the repo name. For example 'Code Repo' -> 'Code Repo.zip'.

It is reccomended to run the zip_dir.sh file as a cronjob nightly to keep changes on the repo up to date.

Security Notes

The viewer exposes file contents under the document root — use caution on shared or public servers. Ensure proper file permissions.

We recommend blocking all other scripts running by adding this to your .htaccess file:


RewriteEngine On

# Rewrite the root "/" request to index.php
RewriteRule ^$ index.php [L]


# Allowed file types
RewriteCond %{REQUEST_URI} \.(png|jpe?g|gif|webp|svg|zip|txt)$ [NC]
RewriteRule .* - [L]


# Block everything except index.php
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule . - [F]

Avoid exposing private repos.

Planned / Possible Enhancements

License

Software provided under the MIT Licence