putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
150 stars 36 forks source link

Error connecting to the Git repository in the Remote Deployment settings #671

Closed handplant closed 5 months ago

handplant commented 5 months ago

Bug Report

The error Error connecting to repository: Exit code: 127 while executing: 'LC_ALL=C '-c' user.name=handplant '-c' user.email=andi.grether@gmail.com remote '--verbose' with reason: sh: -c: command not found occurs. Shouldn't -c be without quotation marks, or is there another issue?

Bildschirmfoto 2024-06-06 um 08 52 49

The paths to the local repo are correct.

Bildschirmfoto 2024-06-06 um 08 55 24

Thanks in advance!

Diagnostics Report

Application Info

Installed Plugins

Loaded Modules

Blitz Plugin Settings

{
    "debug": false,
    "hintsEnabled": true,
    "cachingEnabled": true,
    "refreshCacheEnabled": true,
    "refreshMode": 3,
    "includedUriPatterns": [
        {
            "siteId": "1",
            "uriPattern": ".*"
        },
        {
            "siteId": "1",
            "uriPattern": ""
        }
    ],
    "excludedUriPatterns": [],
    "cacheStorageType": "putyourlightson\\blitz\\drivers\\storage\\FileStorage",
    "cacheStorageSettings": {
        "folderPath": "@webroot\/cache\/blitz",
        "compressCachedValues": ""
    },
    "cacheStorageTypes": [],
    "cacheGeneratorType": "putyourlightson\\blitz\\drivers\\generators\\LocalGenerator",
    "cacheGeneratorSettings": {
        "concurrency": "3"
    },
    "cacheGeneratorTypes": [],
    "customSiteUris": [],
    "cachePurgerType": "putyourlightson\\blitz\\drivers\\purgers\\DummyPurger",
    "cachePurgerSettings": [],
    "cachePurgerTypes": [],
    "deployerType": "putyourlightson\\blitz\\drivers\\deployers\\GitDeployer",
    "deployerSettings": {
        "gitRepositories": {
            "6eab4b84-63fb-4382-bdd7-d2bee959aafb": {
                "repositoryPath": "\/Users\/andee\/Sites\/craft\/playground5-static",
                "branch": "main",
                "remote": "origin"
            },
            "7d2f72c3-2676-4d61-9279-bf2e5b06d06d": {
                "repositoryPath": "\/Users\/andee\/Sites\/craft\/playground5-static",
                "branch": "main",
                "remote": "origin"
            }
        },
        "commitMessage": "Blitz auto commit",
        "username": "handplant",
        "personalAccessToken": "****************************************",
        "name": "handplant",
        "email": "andi.grether@gmail.com",
        "commandsBefore": "",
        "commandsAfter": ""
    },
    "deployerTypes": [],
    "ssiEnabled": false,
    "ssiTagFormat": "<!--#include virtual=\"{uri}\" -->",
    "detectSsiEnabled": true,
    "esiEnabled": false,
    "queryStringCaching": 0,
    "includedQueryStringParams": [
        {
            "siteId": "",
            "queryStringParam": ".*"
        }
    ],
    "excludedQueryStringParams": [
        {
            "siteId": "",
            "queryStringParam": "gclid"
        },
        {
            "siteId": "",
            "queryStringParam": "fbclid"
        }
    ],
    "apiKey": "",
    "generatePagesWithQueryStringParams": true,
    "purgeAssetImagesWhenChanged": true,
    "refreshCacheAutomaticallyForGlobals": true,
    "refreshCacheWhenElementMovedInStructure": true,
    "refreshCacheWhenElementSavedUnchanged": false,
    "refreshCacheWhenElementSavedNotLive": false,
    "cacheNonHtmlResponses": false,
    "trackElements": true,
    "trackElementQueries": true,
    "excludedTrackedElementQueryParams": [],
    "cacheDuration": null,
    "nonCacheableElementTypes": [],
    "sourceIdAttributes": [],
    "liveStatuses": [],
    "integrations": [
        "putyourlightson\\blitz\\drivers\\integrations\\CommerceIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\FeedMeIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\SeomaticIntegration"
    ],
    "defaultCacheControlHeader": "no-store",
    "cacheControlHeader": "public, max-age=31536000",
    "cacheControlHeaderExpired": "public, max-age=5",
    "sendPoweredByHeader": true,
    "outputComments": true,
    "refreshCacheJobPriority": 10,
    "driverJobBatchSize": 100,
    "driverJobPriority": 100,
    "queueJobTtr": 300,
    "maxRetryAttempts": 10,
    "maxUriLength": 255,
    "mutexTimeout": 1,
    "commands": [],
    "injectScriptEvent": "DOMContentLoaded",
    "injectScriptPosition": 3
}

Recommendations

Site Tracking [#1]

Site Tracking [#2]

bencroker commented 5 months ago

The repository path in your local development environment is likely not at /Users/.... When using DDEV, for example, the path will be /var/www/html, which you can verify by running ddev ssh and then pwd. It might be easier, however, to use the @root alias, which points to the route project inside the container. See https://craftcms.com/docs/5.x/configure.html#aliases

handplant commented 5 months ago

No, I don't use DDEV. I use Laravel Herd and I have two repositories and project paths: one for the Craft CMS (playground5) itself and one for the static site (playground5-static), as described in the screenshot.

Bildschirmfoto 2024-06-07 um 07 39 05

bencroker commented 5 months ago

Can you please check the value of PWD under Utilities → PHP Info in the CP?

handplant commented 5 months ago

Under "Utilities → PHP Info," there is no pwd entry. However, my path should be correct. See screenshot.

Bildschirmfoto 2024-06-10 um 08 45 12

bencroker commented 5 months ago

You’re right, the path does look correct, so it may be a problem with the path to the Git binary.

It looks like you’re on MacOS. Can you check whether running which git returns /usr/bin/git or something else? And please check whether git status runs successfully?

handplant commented 5 months ago

I installed git using Homebrew: /opt/homebrew/bin/git. git status is correct. See screenshot.

Bildschirmfoto 2024-06-10 um 09 19 41

bencroker commented 5 months ago

Can please manually add the following above line 195 and share the stack trace? https://github.com/putyourlightson/craft-blitz/blob/87863bbcc32bc72da6fbf3599fea88cfd3a6f634/src/drivers/deployers/GitDeployer.php#L195

throw $exception;
handplant commented 5 months ago

I added throw $exception; and then navigated to http://playground5.test/admin/settings/plugins/blitz?site=de in the control panel. This is where the error occurs.

playground5 test_admin_settings_plugins_blitz_site=de

bencroker commented 5 months ago

Thanks, that unfortunately doesn’t give any clues.

Can you please try defining the Git executable path using the commands config setting as follows? It should be auto-detected but perhaps this is not working.

        // The paths to executable shell commands.
        'commands' => [
            'git' => '/opt/homebrew/bin/git',
        ],
handplant commented 5 months ago

Hey, that helps. I was able to successfully deploy the data to a GitHub repo. Thanks a lot for your effort!

bencroker commented 5 months ago

Great to hear! I’m not sure why it was not correctly auto-detected, possibly a permission issue.