-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Statamic does not find git binary #3392
Comments
Solved by #3393. |
This fix (#3393) doesn't seem to work in nix environments. In order to get things working with my git flake, I had to update the default git commands to include the git binary config. Without these changes, I get
P.S. It should be noted that commands like Example (Removing some fields for brevity):// config/statamic/git.php
<?php
$binary = env('STATAMIC_GIT_BINARY', 'git');
return [
// ...
/*
|--------------------------------------------------------------------------
| Git Binary
|--------------------------------------------------------------------------
|
| By default, Statamic will try to use the "git" command, but you can set
| an absolute path to the git binary if necessary for your environment.
|
*/
'binary' => $binary,
/*
|--------------------------------------------------------------------------
| Commands
|--------------------------------------------------------------------------
|
| Define a list commands to be run when Statamic is ready to `git add`
| and `git commit` your changes. These commands will be run once
| per repo, attempting to consolidate commits where possible.
|
| https://statamic.dev/git-automation#customizing-commits
|
*/
'commands' => [
"$binary add {{ paths }}",
$binary.' -c "user.name={{ name }}" -c "user.email={{ email }}" commit -m "{{ message }}"',
],
// ...
]; # .env
# ...
STATAMIC_GIT_ENABLED=true
# realpath $(which git)
STATAMIC_GIT_BINARY=/nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git
# ... # flake.nix
{
description = "Testing statamic";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/23.11";
sbrow.url = "github:sbrow/nix";
flake-parts.url = "github:hercules-ci/flake-parts";
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
};
outputs = inputs@{ self, flake-parts, nixpkgs, process-compose-flake, sbrow }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.process-compose-flake.flakeModule
];
systems = [ "x86_64-linux" ];
perSystem = { pkgs, system, ... }:
{
formatter = pkgs.nixpkgs-fmt;
# See process-compose.yaml for details
process-compose.default.settings = {
processes = {
web.command = "sudo ${pkgs.caddy}/bin/caddy run";
php.command = "${pkgs.php}/bin/php-fpm -F -y php-fpm.conf";
};
};
devShells.default = pkgs.mkShell
{
buildInputs = with pkgs; [
caddy
php
yarn
process-compose
git
] ++ (with phpPackages; [
composer
]);
};
};
};
} |
This issue is over 3 years old. To avoid past participants being notified, are you able to open a new issue instead? Feel free to reference this one. |
Bug Description
I have installed Statamic in a shared hosting package with Git installed, which works as usual by typing
git
in the Shell. However when Git is enabled in Statamic I get the errorgit: not found
.How to Reproduce
I cannot really say how to reproduce, because it seems to be an environment specific issue with this shared hosting. The PHP process runs with the same user as the shell user, which has a working
git
command. However, setting an absolute path to the binary (like/usr/local/bin/git
) in the Statamic Core (Git.php) helps to fix this problem.Extra Detail
Environment
Statamic 3.0.46 Pro
Laravel 8.32.1
PHP 7.4.16
Install method (choose one):
statamic/statamic
The text was updated successfully, but these errors were encountered: