trilbymedia / grav-plugin-git-sync

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

gitSync does not commit (and push) #200

Closed genofire closed 3 years ago

genofire commented 3 years ago

Plugin-Version: v2.3.0 Grav-Version: v1.7.14 Admin-Version: v1.10.14


every bin/plugin git-sync command shows no error, exclude status

# bin/plugin git-sync status
PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1802 but version 1803 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

plugin runtime information:
^ array:18 [
  "branch" => "main"
  "enabled" => true
  "folders" => "['pages', 'themes', 'plugins', 'config', 'data']"
  "git" => array:7 [
    "author" => "gituser"
    "message" => "(Grav GitSync) Automatic Commit"
    "name" => "GitSync"
    "email" => "git-sync@trilby.media"
    "bin" => "git"
    "ignore" => null
    "private_key" => "/.ssh/id_rsa"
  ]
  "gitVersion" => "2.31.1"
  "isGitInitialized" => true
  "local_repository" => null
  "logging" => false
  "no_user" => "1"
  "password" => "gitsync-randompasssword"
  "remote" => array:2 [
    "name" => "origin"
    "branch" => "main"
  ]
  "repository" => "git@gitea:group/webseite-grav.git"
  "repositoryPath" => "/user/"
  "sync" => array:5 [
    "on_save" => true
    "on_delete" => true
    "on_media" => true
    "cron_enable" => false
    "cron_at" => "0 12,23 * * *"
  ]
  "username" => ""
  "webhook" => "/_git-sync-RANDOM"
  "webhook_enabled" => "1"
  "webhook_secret" => "IS SECRET"
]
detect git workspace root:
  /user
local git config:
  core.repositoryformatversion=0
  core.filemode=true
  core.bare=false
  core.logallrefupdates=true
  core.sparsecheckout=true
  core.sshcommand=ssh -i /.ssh/id_rsa -F /dev/null
  user.name=GitSync
  user.email=git-sync@trilby.media
  remote.origin.url=git@gitea:group/webseite-grav.git
  remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
  branch.main.remote=origin
  branch.main.merge=refs/heads/main
Testing connection to repository(git ls-remote)...
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Grav\Plugin\GitSync\GitSync::testRepository(), 1 passed in /user/plugins/git-sync/cli/StatusCommand.php on line 91 and exactly 2 expected in /user/plugins/git-sync/classes/GitSync.php:116
Stack trace:
#0 /user/plugins/git-sync/cli/StatusCommand.php(91): Grav\Plugin\GitSync\GitSync->testRepository('git@gitea...')
#1 /system/src/Grav/Console/ConsoleCommand.php(33): Grav\Plugin\Console\StatusCommand->serve()
#2 /vendor/symfony/console/Command/Command.php(255): Grav\Console\ConsoleCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Grav\Plugin\Console\StatusCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /system/src/Grav/Console/Application/PluginApplication.php(80): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /bin/plugin(51): Grav\Console\Application\PluginApplication->run()
#8 {main}
  thrown in /user/plugins/git-sync/classes/GitSync.php on line 116

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Grav\Plugin\GitSync\GitSync::testRepository(), 1 passed in /user/plugins/git-sync/cli/StatusCommand.php on line 91 and exactly 2 expected in /user/plugins/git-sync/classes/GitSync.php:116
Stack trace:
#0 /user/plugins/git-sync/cli/StatusCommand.php(91): Grav\Plugin\GitSync\GitSync->testRepository('git@gitea...')
#1 /system/src/Grav/Console/ConsoleCommand.php(33): Grav\Plugin\Console\StatusCommand->serve()
#2 /vendor/symfony/console/Command/Command.php(255): Grav\Console\ConsoleCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Grav\Plugin\Console\StatusCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /system/src/Grav/Console/Application/PluginApplication.php(80): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /bin/plugin(51): Grav\Console\Application\PluginApplication->run()
#8 {main}
  thrown in /user/plugins/git-sync/classes/GitSync.php on line 116

Extra git informations:

# bin/plugin git-sync sync
PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1802 but version 1803 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

Synchronizing with git@gitea:group/webseite-grav.git
Changes detected, adding and committing...
Starting Synchronization...completed.

# git -C user ls-remote
From git@gitea:group/webseite-grav.git
c4ec32f50caf898db1736cce5766d5b275d9171a    HEAD
c4ec32f50caf898db1736cce5766d5b275d9171a    refs/heads/main
# git -C user status
On branch main
Your branch is up to date with 'origin/main'.

You are in a sparse checkout with 100% of tracked files present.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   config/plugins/git-sync.yaml
    modified:   data/flex/indexes/pages.json
    modified:   pages/home/default.md
w00fz commented 3 years ago

Good catch @genofire ,

I actually introduced an issue with my latest release where the status command was throwing an error and the testRepository would erroneously pass with invalid credentials

I have just released v2.3.1 and should be looking good now.

Thanks,