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 autocommitting broken on a fresh install of Statamic #10102

Closed
amadeann opened this issue May 16, 2024 · 3 comments · Fixed by #10134
Closed

Git autocommitting broken on a fresh install of Statamic #10102

amadeann opened this issue May 16, 2024 · 3 comments · Fixed by #10134
Labels

Comments

@amadeann
Copy link

Bug description

Please see the thread:
https://discord.com/channels/489818810157891584/1240373773279039499/1240374342303350876

for reference.

Autocommit to git fails with messages like:

[2024-05-16 21:39:36] production.ERROR: Process Class: Git
Command:  -c "user.name=Amadeusz Annissimo" -c "user.email=me@example.com" commit -m "Content saved"
Error: sh: 1:
-c: not found  

Replacing config('statamic.git.binary') to hardcoded git fixes the issue. Most likely this bug was introduced here:
770dc48

How to reproduce

Fresh install of Statamic.
Set up git autocommit as per docs.
Make any changes in the entry.
Check application logs for errors.

Logs

No response

Environment

Environment
Application Name: *****
Laravel Version: 10.48.8
PHP Version: 8.3.3-1+ubuntu22.04.1+deb.sury.org+1
Composer Version: 2.7.6
Environment: production
Debug Mode: OFF
URL: *****
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: mailgun
Queue: sync
Session: file

Statamic
Addons: 2
Antlers: runtime
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.56.1 PRO

Statamic Addons
statamic/seo-pro: 5.4.4
stefangalescu/statamic-heroicons: 2.1.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@godismyjudge95
Copy link
Contributor

Did you try clearing your config cache?

php artisan config:clear

It sounds like the config('statamic.git.binary') is returning empty which should not be happening if you have this line in your config: https://github.com/statamic/cms/blob/4.x/config/git.php#L119

    'binary' => env('STATAMIC_GIT_BINARY', 'git'),

@amadeann
Copy link
Author

@godismyjudge95
Yes, I did. My guess is that you can't reference config values from the same config file you're on.

I tested it to on a fresh install of Statamic.

When you run in tinker:
config('statamic.git.binary'), you get git.

When you run:
config('statamic.git.commands'), you get:
[ " add {{ paths }}", " -c "user.name={{ name }}" -c "user.email={{ email }}" commit -m "{{ message }}"", ]

Meaning, the config('statamic.git.binary') is not read from config. Doesn't matter if I set STATAMIC_GIT_BINARY to git, or even hardcode statamic.git.binary to git. The value is always blank when referenced dynamically from statamic.git.commands.

It worked fine before this: 770dc48

@jasonvarga
Copy link
Member

I didn't think you could reference from the same file either, but when I tested that PR it seemed to work. Maybe I had something weird setup and got a false positive. We can check it over.

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

Successfully merging a pull request may close this issue.

4 participants