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

Azure Git binary path #122

Closed MaxDriller closed 5 years ago

MaxDriller commented 5 years ago

Hi, I'm running grav on azure in a windows based envrionment based on the documentation. I've installed the git sync plugin but the wizard is not coming up for me. The path to my git binary is D:\Program Files\Git\bin and it has been entered in the advanced settings; still the wizard refuses to come up and keeps showing me the popup about git needing to be installed.

The binary itself is called git.exe. I've tried supplying the path with and without the binary name and its extension. I've also tried copying the binary into the plugin folder to no avail.

Is there something else I can try?

goldjg commented 5 years ago

I'm seeing exactly the same behaviour on an Azure Web App (using windows rather than Linux). Currently working on an Azure WebJob that runs php bin/grav backup then runs D:\"Program Files"\Git\bin\git.exe to push the backup up to the repo. Got the first bit done, working on the git push just now. Will share my code if successful.

goldjg commented 5 years ago

I’ve found that I can run git from the Kudu debug console, but still not from the Git Sync plugin. I also created a php script to run phpinfo() when accessed through the browser (and this works), but a php script to issue an echo exec(‘git —version') works when executed on the console but returns an empty page when run from the browser. exec() and escapeshellarg() aren’t disabled but I think some other azure lockdown might be at play here (I’m using a shared Web App, perhaps a dedicated one will have less restrictions).

I did find that as well as D:\home\site\wwwroot\ there’s also a D:\home\site\repository\ which contains the code deployed from GitHub, prior to being built by msbuild as part of the deployment (Azure Web Apps can auto-deploy from a git repo using a web hook - I only wanted Git Sync so I could move some files back up to GitHub e.g. Grav backups.)

w00fz commented 5 years ago

Guys I just tested this and the issue is you can't escape the binary path like you are doing (quotes on "Program Files", the whole command has to be escaped.

"D:\Program Files\Git\bin\git.exe" <- try that and it will work.

I'll make sure to explain this better in the documentation

w00fz commented 5 years ago

Something like this, what do you guys think?

azure docs
goldjg commented 5 years ago

Gah! Staring me in the face (and it’s not like I’ve not hit my head off that before in scripting)!

I would maybe tweak the wording as if someone is running a Windows VM on Azure (or indeed running Grav/PHP/IIS on their own computer) they may have a different path to git than on an Azure Web App (Windows). Perhaps just state that the path shown is for an Azure Web App on Windows but the path may vary by installation e.g on a VM or physical computer.