Skip to content

Git command failed (exit-code 129) unknown option: 'end-of-option' #86

@rizpras

Description

@rizpras

I use git-php in Lumen framework with the following code

  try{
        $git = new Git();
        $remote = env('GIT_URL').$request->code;

        $local = storage_path('repo')."/".$request->code;
        $repo = $git->open($local);
        $repo->execute("config", "user.name", "latexbki");
        $repo->execute("config", "user.email", "[email protected]");

        $filename = $repo->getRepositoryPath() . '/'.$request->file;
        file_put_contents($filename, $request->content);
        
        $repo->addFile($filename);
        $repo->commit("test adding notes", "--author=latexbki <[email protected]>");
        $repo->push(NULL, ['--repo'=>$remote]);

        return response()->json(['status'=>"success", 'message'=>"Changes pushed to remote successfully"], 200);
    }catch(\Exception $e)
    {
        $errormessage = "Draft Controller: ".$e->getMessage()." -- in line ".$e->getLine();
        return response()->json(['code'=>500, 'status'=>"error", 'message'=>$errormessage], 500);
    }

When I run the code, I get the error
Command 'git push --repo 'https://latex.bki%40gmail.com:[email protected]/62c7951c097b4c6fdf2980b4' --end-of-options' failed (exit-code 129). error: unknown option end-of-options

I previously get the same error from addFile and I resolve it by commenting the end-of-option part.

My questions are:

  1. Is it okay if I commented the end-of-option part? The code run just fine with the option commented out
  2. Is it maybe related to the git version? For information, I am using a rather old server with git version 2.7.4

Thank you very much

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions