matteosister/GitElephant

Error calling all the functions

alwinaugustin opened this issue · 1 comments

I am working on a Windows machine and trying to use this library. I am using the following code in my Laravel app to initialize the repo and is getting the following output.


        $path = public_path() . '/theia';
        $repo = new Repository($path);
        print_r($repo);


GitElephant\Repository Object
(
    [path:GitElephant\Repository:private] => C:\wamp64\www\my-folder\public/theia
    [caller:GitElephant\Repository:private] => GitElephant\Command\Caller\Caller Object
        (
            [repositoryPath:GitElephant\Command\Caller\Caller:private] => C:\wamp64\www\maxdev\public/theia
            [rawOutput:GitElephant\Command\Caller\Caller:private] => 
            [binaryPath:protected] => 
            [binaryVersion:protected] => 
            [outputLines:protected] => Array
                (
                )

        )

    [name:GitElephant\Repository:private] => 
    [globalConfigs:GitElephant\Repository:private] => Array
        (
        )

    [globalOptions:GitElephant\Repository:private] => Array
        (
        )

    [globalCommandArguments:GitElephant\Repository:private] => Array
        (
        )

)

After this, I am trying to call the getStatus() on the repository object, but it is showing the following error:

Exit code: 1 while executing: " status "--porcelain"" with reason: 'status' is not recognized as an internal or external command, operable program or batch file.

Given that the error says that it failed to execute \ status, instead of git status, I presume your git installation is not automatically detected. Use the second argument when instantiating the Repository to set the git binary path (your git.exe path, in the following as an example 'path\to\git.exe'), e.g.:

$repo = new Repository($path, 'path\\to\\git.exe');
// your code