php-git-server icon indicating copy to clipboard operation
php-git-server copied to clipboard

Installation

Open volomike opened this issue 6 years ago • 2 comments

Please explain how the config.php.sample is customized.

volomike avatar Jan 21 '19 16:01 volomike

// re name file to config.php

// change url base example: // http://hostname/git/repo.git $url_base = '/git';

// Repositories $repos = array( // repo create by git init, never use git init --bare array("/repo.git", "/home/user/repo/.git") );

// sorry for my bad english

luisvegaa avatar May 23 '21 03:05 luisvegaa

Hello,

  1. first off: COOL that it is (IN THEORY) possible to implement a git-server in PHP :)

  2. problem: this implementation seems

2.1.) HIGHLY incomplete (no push, just get)

2.2.) seems to require a webserver that has access to the git command

  1. the config.php.sample actually DOES NOT WORK :(

check out this bit of code:


foreach ($repos as $repo)
{
    $search_for_this = '~^' . $url_base . $repo[0] . '(/.*)~';
    //                              in this
    if(preg_match($search_for_this, $url_path, $matches))
    {

with the above config from luisveega that would result in:


$search_for_this = ~^/git/repo.git(/.*)~	
$url_path = /php-git-server/index.php

which will result in $matches being EMPTY as the pattern '/git/repo.git' can not be found in /php-git-server/index.php

maybe getting something wrong here... but this implementation seems completely broken.

it might be an "wow it could be done" repo.

but right now it does not seem to be of any use in this state?

so in theory the user could do a:

git clone http://localhost/php-git-server/index.php (? but how to pass parameter which repo to clone?)

and it will issue this command to the server:

$_REQUEST Array [1] service=git-upload-pack

which equals to calling:

http://localhost/php-git-server/index.php?service=git-upload-pack

if someone is really good at git (which in itself is complex) and would like to make a better actually working git php-sever let me know :D (imho COULD do the php part)

check out: https://git-scm.com/docs/gitprotocol-v2

Edgepath avatar Jan 23 '23 18:01 Edgepath