0

I've been using git hooks on GitLab and got error

Hook execution failed Net::ReadTimeout when trying to clone a repository

is git hook has limit ?

I have 866 websites listed on Integration

enter image description here

some domains failed to pull (but when i click resend request, it's working)

here it is my php script for pull / clone the repository

<?php 



const SECRET_KEY = 'helloWorld';
function execPrint($command) {
    return shell_exec($command." 2>&1");
}

$header = getallheaders();
$git    = "cms-sma";

if($header['X-Gitlab-Event'] !== "Push Hook"){
    http_response_code(401);
    echo json_encode(['message'=>'Disallowed Event']);
    die;
}

if($header['X-Gitlab-Token'] !== SECRET_KEY){
    http_response_code(401);
    echo json_encode(['message'=>'Token mismatch.']);
    die;
}


if (is_dir(".git"))
{
    print("<pre>" . execPrint("git stash") . "</pre>");
    print("<pre>" . execPrint("git pull https://username:password@gitlab.com/username/".$git.".git master") . "</pre>");
    print("<pre>" . execPrint("git stash pop") . "</pre>");
}
else
{
    print("<pre>" . execPrint("git init") . "</pre>");
    print("<pre>" . execPrint("git clone https://username:password@gitlab.com/username/".$git.".git ".$git.";rm -rf .git/; mv ".$git."/* ".$git."/.htaccess ".$git."/.git* .; rm -rf ".$git) . "</pre>");
}


?>

Anyone have solution about it ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.