ornicar/php-git-repo

Git Error 128

philipzaengle opened this issue · 3 comments

I'm hitting a wall when trying to checkout a branch via this library, I get the following error:

Fatal error:  Uncaught exception 'GitRuntimeException' with message 'Command cd '/Sites/demo.com' && /usr/bin/git checkout development failed with code 128: ' in /Users/username/site/addons/libraries/phpgit/Phpgit_Command.php:58
Stack trace:
#0 /Sites/demo.com/addon/libraries/phpgit/Phpgit_Repository.php(198): PHPGit_Command->run()
#1 /Sites/demo.com/addon/index.php(27): PHPGit_Repository->git('git checkout de...')
#2 {main}
  thrown in /Sites/demo.com/addon/libraries/phpgit/Phpgit_Command.php on line 58

I am able to get a list of branches, tags without issue.

Work:
$repo->git("help");
$repo->git("branch");
$repo->git("status");

Fail:
$repo->git("checkout development");

I able to run the checkout command without issue via the command line locally.

anyone else seeing this issue or have experience fixing it?

I am getting a similar issue when trying to perform git pull error: cannot open .git/FETCH_HEAD: Permission denied

Probably the user don't have permissions to rewrite the files in the repository.

Test in the console with sudo -u www-data git checkout development (replace www-data with the name of the user)

I use Git library, when I pull repo, i get the following error:

Caught exception:
fatal: unable to find a suitable socket path; use --socket
fatal: could not read Password for 'https://abc@bitbucket.org': No such device or address

my code:
require_once('Git.php');
$repo = Git::open('/var/www/html/abc');
$repo->pull('remoteNS', 'develop');

I clone and add remote via git command.
please help, thanks.