trilbymedia / grav-plugin-git-sync

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

`Synchronize` fails silently from Admin plugin #96

Closed bsheen closed 3 years ago

bsheen commented 6 years ago

Running the bin/plugin git-sync sync command from the CLI yields:

Synchronizing with https://github.com/code-heroes-pty-ltd/Website.git
Changes detected, adding and committing...

  [RuntimeException]                                                           
  *** Please tell me who you are.                                              
  Run                                                                          
    git config --global user.email "you@example.com"                           
    git config --global user.name "Your Name"                                  
  to set your account's default identity.                                      
  Omit --global to set the identity only in this repository.                   
  fatal: unable to auto-detect email address (got 'root@0f249caa6b8b.(none)')  

sync

However, from http://localhost/admin/plugins/git-sync in the Admin if I click Synchronize I get the following message: GitSync has successfully synchronized with the repository But changes are not reflected in the repo on GitHub.

When I execute the git config commands as suggested both the CLI command and Synchronize button in the Admin plugin work as expected and the changes are reflected in the repo.

Obviously, this is easily dealt with by setting git user.email and user.name via the config command. However, I'm reporting this as better reporting of the error in the Admin plugin would be beneficial for those attempting to track down why syncing is not working from the Admin plugin.

w00fz commented 6 years ago

I will try to catch this scenario. Keep in mind that those global steps are kinda mandatory for any kind of git activity. I hear you though that it would be nice to get at least the same output in the admin to understand what's going on.

bsheen commented 6 years ago

@w00fz to add further context, I was installing the plugin into a Grav installation which is part of a Docker container. Hence, git wasn't setup as it would be as would be on a development machine.

As you say, it would be helpful to get an appropriate error message in the admin to point the user quickly to a resolution.

w00fz commented 6 years ago

Do you know if there's a way to get this reproduced after git is all set? I'm trying to get to that state on my local but I can't get it erroring out.

I removed my user/email from ~/.gitconfig and user/.git/config but still goes through the synchronization.

bsheen commented 6 years ago

You could look at spinning Grav up inside of a Docker container from one of the public images: https://hub.docker.com/r/benjick/grav/

w00fz commented 5 years ago

I tried again from the benjick/grav docker but it did work as expected from both admin and CLI. Doesn't seem like I can reproduce this, not until I reinstall my machine perhaps. Or perhaps this is already sorted somehow on GitSync?

If anyone has any idea how i can reproduce on mac or ubuntu the Please tell me who you are error, I can try simulating it. Right now I just can't find any way to get that error popping up after I already have my globals configured, sorry.

bsheen commented 5 years ago

@w00fz thanks for your efforts. This issue/discussion might help anyone in future facing the same find a resolution.