trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
240 stars 58 forks source link

'Unknown Error' cropping up on local MAMP setup #165

Closed MattAppleton closed 3 years ago

MattAppleton commented 4 years ago
Screenshot 2020-03-17 11 33 29

Hi there — I have a site that has been working beautifully with local (MAMP folder) / remote syncing for a year or so, but recently I am getting an 'unknown error' when trying to sync. I f I uninstall and reinstall the plugin, I still get this error, even when doing a basic 'test connection'

Could this be something related to Catalina security or MAMP updates? Anyone else seeing this error?

Syncing from the remote site works fine.

w00fz commented 4 years ago

Hey @MattAppleton,

Have you tried enabling the Git Logs in the GitSync plugin? Enable "Log Git Commands" under the "Advanced Git Settings" section.

That should provide more information about what the actual issue is. That Unknown error is of course not enough to understand what's going on.

You should then be able to see the logs from the admin at /admin/tools/logs

MattAppleton commented 4 years ago

Ill check the logs now I have a sec, and on another machine in case it is a local / Catalina issue…

Matt

On 17 Mar 2020, at 19:41, Djamil Legato notifications@github.com wrote:

Hey @MattAppleton https://github.com/MattAppleton,

Have you tried enabling the Git Logs in the GitSync plugin? Enable "Log Git Commands" under the "Advanced Git Settings" section.

That should provide more information about what the actual issue is. That Unknown error is of course not enough to understand what's going on.

You should then be able to see the logs from the admin at /admin/tools/logs

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trilbymedia/grav-plugin-git-sync/issues/165#issuecomment-600261388, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQBBHUM5TUUNGFJEY42DR3RH7G5HANCNFSM4LNKS5NA.

MattAppleton commented 4 years ago

I get

March 17th at 9:06pm | NOTICE | gitsync[command]: LC_ALL=C cd /Users/matthewappleton/Dropbox (Modern Activity)/GRAV/grav-SEC/user/ && git ls-remote "https://MattAppleton:{password}@github.com/MattAppleton/SEClauncher01.git" 2>&1
-- | -- | --
w00fz commented 4 years ago

That's all? Bizarre, I would have expected more logs. Have you tried saving a Page or something to trigger a sync and check the logs again?

MattAppleton commented 4 years ago

Log Git commands is 'enabled' in the admin and git-sync.yaml.

But I am stuck in a loop setting up Git Sync on the local machine. If I use the wizard to fill in the Git credentials it keeps sending me back to 'Step 1'...

MattAppleton commented 4 years ago

If I hit 'save' on the plugin page it sends me back to beginning of the wizard...

MattAppleton commented 4 years ago

Wondering what the correct procedure for erasing / starting again is with gitsync? It feels like the plugin install is somehow compromised on the local / MAMP version. The live admin syncs fine :)

MattAppleton commented 4 years ago

Live log is MUCH more verbose!

Screenshot 2020-03-17 21 38 20
w00fz commented 4 years ago

Yeah that's the kinda log I was expecting to see.

You can reset your local by deleting the plugin itself, deleting the user/config/plugins/git-sync.yaml and most likely you might need to also delete the .git/info/sparse-checkout that GitSync generates for you. At this point, try reinstalling GitSync and follow the wizard steps, see if it helps.

I am also running macOS Catalina and haven't had this issue before, however I do not use MAMP, I used to use MAMP in the past but it has caused many issues for me so I just follow our Grav guide (https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions)

MattAppleton commented 4 years ago

OK, thanks, will try that...

MattAppleton commented 4 years ago

So far no joy, after deleting plugin, reinstalling... same 'Unknown Error'

If I look at the web hook on Github I do see failed deliveries though — coudl be a clue?

`{ "ref": "refs/heads/master", "before": "63de9bfa99cd0d05f8e4bc04dbde9ac2f420679a", "after": "8e66754567ba6457e2b2fbb744bc5d17084be03e", "repository": { "id": 214906475, "node_id": "MDEwOlJlcG9zaXRvcnkyMTQ5MDY0NzU=", "name": "SEClauncher01", "full_name": "MattAppleton/SEClauncher01", "private": true, "owner": { "name": "MattAppleton", "email": "matt@modernactivity.com", "login": "MattAppleton", "id": 6295710, "node_id": "MDQ6VXNlcjYyOTU3MTA=", "avatar_url": "https://avatars1.githubusercontent.com/u/6295710?v=4", "gravatar_id": "", "url": "https://api.github.com/users/MattAppleton", "html_url": "https://github.com/MattAppleton", "followers_url": "https://api.github.com/users/MattAppleton/followers", "following_url": "https://api.github.com/users/MattAppleton/following{/other_user}", "gists_url": "https://api.github.com/users/MattAppleton/gists{/gist_id}", "starred_url": "https://api.github.com/users/MattAppleton/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/MattAppleton/subscriptions", "organizations_url": "https://api.github.com/users/MattAppleton/orgs", "repos_url": "https://api.github.com/users/MattAppleton/repos", "events_url": "https://api.github.com/users/MattAppleton/events{/privacy}", "received_events_url": "https://api.github.com/users/MattAppleton/received_events", "type": "User", "site_admin": false }, "html_url": "https://github.com/MattAppleton/SEClauncher01", "description": "SEC prelaunch", "fork": false, "url": "https://github.com/MattAppleton/SEClauncher01", "forks_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/forks", "keys_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/teams", "hooks_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/hooks", "issue_events_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/issues/events{/number}", "events_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/events", "assignees_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/assignees{/user}", "branches_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/branches{/branch}", "tags_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/tags", "blobs_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/git/refs{/sha}", "trees_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/statuses/{sha}", "languages_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/languages", "stargazers_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/stargazers", "contributors_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/contributors", "subscribers_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/subscribers", "subscription_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/subscription", "commits_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/commits{/sha}", "git_commits_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/git/commits{/sha}", "comments_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/comments{/number}", "issue_comment_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/issues/comments{/number}", "contents_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/contents/{+path}", "compare_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/merges", "archive_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/downloads", "issues_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/issues{/number}", "pulls_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/pulls{/number}", "milestones_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/milestones{/number}", "notifications_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/labels{/name}", "releases_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/releases{/id}", "deployments_url": "https://api.github.com/repos/MattAppleton/SEClauncher01/deployments", "created_at": 1571007623, "updated_at": "2020-03-17T21:33:35Z", "pushed_at": 1584481421, "git_url": "git://github.com/MattAppleton/SEClauncher01.git", "ssh_url": "git@github.com:MattAppleton/SEClauncher01.git", "clone_url": "https://github.com/MattAppleton/SEClauncher01.git", "svn_url": "https://github.com/MattAppleton/SEClauncher01", "homepage": null, "size": 77138, "stargazers_count": 0, "watchers_count": 0, "language": "CSS", "has_issues": true, "has_projects": true, "has_downloads": true, "has_wiki": true, "has_pages": false, "forks_count": 0, "mirror_url": null, "archived": false, "disabled": false, "open_issues_count": 0, "license": null, "forks": 0, "open_issues": 0, "watchers": 0, "default_branch": "master", "stargazers": 0, "master_branch": "master" }, "pusher": { "name": "MattAppleton", "email": "matt@modernactivity.com" }, "sender": { "login": "MattAppleton", "id": 6295710, "node_id": "MDQ6VXNlcjYyOTU3MTA=", "avatar_url": "https://avatars1.githubusercontent.com/u/6295710?v=4", "gravatar_id": "", "url": "https://api.github.com/users/MattAppleton", "html_url": "https://github.com/MattAppleton", "followers_url": "https://api.github.com/users/MattAppleton/followers", "following_url": "https://api.github.com/users/MattAppleton/following{/other_user}", "gists_url": "https://api.github.com/users/MattAppleton/gists{/gist_id}", "starred_url": "https://api.github.com/users/MattAppleton/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/MattAppleton/subscriptions", "organizations_url": "https://api.github.com/users/MattAppleton/orgs", "repos_url": "https://api.github.com/users/MattAppleton/repos", "events_url": "https://api.github.com/users/MattAppleton/events{/privacy}", "received_events_url": "https://api.github.com/users/MattAppleton/received_events", "type": "User", "site_admin": false }, "created": false, "deleted": false, "forced": false, "base_ref": null, "compare": "https://github.com/MattAppleton/SEClauncher01/compare/63de9bfa99cd...8e66754567ba", "commits": [ { "id": "8e66754567ba6457e2b2fbb744bc5d17084be03e", "tree_id": "3cad4f8a1463b72e7fb831ac0c66ada99aba032f", "distinct": true, "message": "(Grav GitSync) Automatic Commit from MattAppleton", "timestamp": "2020-03-17T21:43:34Z", "url": "https://github.com/MattAppleton/SEClauncher01/commit/8e66754567ba6457e2b2fbb744bc5d17084be03e", "author": { "name": "MattAppleton", "email": "git-sync@trilby.media", "username": "trilby-bot" }, "committer": { "name": "GitSync", "email": "git-sync@trilby.media", "username": "trilby-bot" }, "added": [

  ],
  "removed": [

  ],
  "modified": [
    "pages/14.success-stories/sec-page-m1.md"
  ]
}

], "head_commit": { "id": "8e66754567ba6457e2b2fbb744bc5d17084be03e", "tree_id": "3cad4f8a1463b72e7fb831ac0c66ada99aba032f", "distinct": true, "message": "(Grav GitSync) Automatic Commit from MattAppleton", "timestamp": "2020-03-17T21:43:34Z", "url": "https://github.com/MattAppleton/SEClauncher01/commit/8e66754567ba6457e2b2fbb744bc5d17084be03e", "author": { "name": "MattAppleton", "email": "git-sync@trilby.media", "username": "trilby-bot" }, "committer": { "name": "GitSync", "email": "git-sync@trilby.media", "username": "trilby-bot" }, "added": [

],
"removed": [

],
"modified": [
  "pages/14.success-stories/sec-page-m1.md"
]

} }`

w00fz commented 4 years ago

I believe you have to re-setup the webhook now, do you have the webhook id on gitsync and the websecret matching on GitHub ?

MattAppleton commented 4 years ago

I will set them up again...

MattAppleton commented 4 years ago

Web Hook Secret should be empty I believe? So not sure what

the websecret matching on GitHub ?

is about?

MattAppleton commented 4 years ago

Ugh.

Deleted on local and remote, only the remote lets me reinstall and setup the plugin, even after setting up new repo and web hook... Local site still giving the unknown error...

w00fz commented 4 years ago

I am wondering if it's just MAMP causing this, unfortunately I haven't been using MAMP in a long time but I remember having had issues with it for other things in the past.

MattAppleton commented 4 years ago

me too - -or possibly Little Snitch... Ill try two more things - simply copying down remote to local and a non-MAMP option...

MattAppleton commented 4 years ago

Seems this error is something to do with the newest version of the plugin... just testing further, but on another site I was able to successfully gitsync via MAMP, until we updated GRAV...

MattAppleton commented 4 years ago

Hello @w00fz

I can confirm the 2.05 plugin version does NOT encounter the 'unknown error'!

MattAppleton commented 4 years ago

I can confirm (on two sites now) — all of the other core plugins and GRAV itself can be updated without issue, but updating the git-sync breaks MAMP compatibility. v2.05 gitsync is running smoothly still...

w00fz commented 4 years ago

Hey @MattAppleton ,

Wondering if you managed to resolve the issue somehow or if it's still a problem? I have pushed a few changes and am curious to know if that helps, you can try and download the plugin as 'develop' from https://github.com/trilbymedia/grav-plugin-git-sync/archive/develop.zip

Also, what PHP version are you running?

MattAppleton commented 4 years ago

Hi hi @w00fz

Apologies for slug-like reply. As before, upgrading my local MAMP-hosted Grav to git-sync 2.1.0 breaks git-sync. I am running php 7.3.1... and can confirm this update definitely breaks.

MattAppleton commented 4 years ago

Updating MAMP PHP to 7.4.2 doesn't help.

MattAppleton commented 4 years ago

If I try adding your new plugin...

`/Volumes/X8 1TB/Dropbox (Modern Activity)/GRAV/GOOD projects/user/plugins/git-sync/classes/GitSync.php protected $config; /* @var string / protected $repositoryPath;

/** @var string|null */
private $user;
/** @var string|null */
private $password;

public function __construct()
{
    $this->grav = Grav::instance();
    $this->config = $this->grav['config']->get('plugins.git-sync');
    $this->repositoryPath = isset($this->config['local_repository']) && $this->config['local_repository'] ? $this->config['local_repository'] : USER_DIR;

    parent::__construct($this->repositoryPath);

    static::$instance = $this;

    $this->user = $this->config['no_user'] ? '' : ($this->config['user'] ?? null);
    $this->password = $this->config['password'] ?? null;

    unset($this->config['user'], $this->config['password']);
}

/**
 * @return static
 */
public static function instance()
{
    if (null === static::$instance) {
        static::$instance = new static;
    }

    return static::$instance;
}

/**
 * @return string|null
 */

Arguments "Undefined index: no_user"`

MattAppleton commented 4 years ago

reverting back to 2.0.5 works :)

w00fz commented 3 years ago

Sorry for the delay here @MattAppleton , I am assuming this is resolved right? That line about the undefined index no_user was changed with an isset($this->config['no_user']) which should prevent that error from happening again.

Going to close the issue but please feel free to ping again or reopen if this is still a problem.