Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Commit Command Fails (Exit Code 1) #74

Open
dmerfeld opened this issue Sep 15, 2021 · 3 comments
Open

Git Commit Command Fails (Exit Code 1) #74

dmerfeld opened this issue Sep 15, 2021 · 3 comments

Comments

@dmerfeld
Copy link

dmerfeld commented Sep 15, 2021

My code structure looks something like this:

use CzProject\GitPhp\Git;

$git = new Git;

$repo = $git->open(base_path());  // base path of local files
$repo->checkout('main');
$repo->pull('origin');

// make some changes to the local files.

// check for changes made
if ($repo->hasChanges()) {
  $repo->addAllChanges();
  $repo->commit('My Commit Message');
  $repo->push(NULL, array('--repo' => 'https://'.env('GITHUB_USER').':'.env('GITHUB_PASS').'@github.com/MyUser/MyRepo.git'));
}

I am able to read the repo, make changes, detect those changes all with success. However when I try to do a commit, I get an error. Command 'git commit -m 'My Commit Message'' failed (exit-code 1).

I've tried setting up the repo to use https and SSH, both fail at the same step. All commands continue to work in the Terminal as expected. Any thoughts on why I would get a failure on the commit command?

@janpecha
Copy link
Contributor

Hello, I don't know where can be problem but try to dump error output:

try {
  $repo->commit('message');
} catch (\CzProject\GitPhp\GitException $e) {
  var_dump($e->getRunnerResult()->toText());
}

Maybe it helps to find solution.

@dmerfeld
Copy link
Author

I'm not sure if this might be helpful but here's the output:

string(319) "$ git commit -m message

---- STDOUT: 



---- STDERR: 

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
.husky/pre-commit: line 4:  9262 Abort trap: 6           npm test
husky - pre-commit hook exited with code 134 (error)

=> 1

@janpecha
Copy link
Contributor

It's look like problem with pre-commit hook. Unfortunately I don't know how to solve it, I don't use husky tool :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants