Is it possible with the Plesk Git extension to commit changes made directly on the server (e.g. files uploaded by the client to his website)?
The extension is configured to track a remote (GitHub) repository and the only option provided is “Pull last commits“. It doesn’t seem to offer a Commit or Push functionnality.
I tried to manually commit local changes when connected to the server through ssh, but there’s no .git directory in my working tree so I can’t run a git
command…
5
Answers
According to a member of the Plesk Team :
see : https://talk.plesk.com/threads/commit-changes-made-on-the-server-with-git-extension-for-plesk-onyx.342362/#post-822292
As I know Plesk Git extension creates bare repositories only(or in human mean “deployment mode” only) so there is no working tree and commit and push is not available.
This decision is based on there is no “development” on “production server”.
I don’t know will this extension support non-bare repositories in future or not.
You can commit and push on your git server.
In my case, I have my website files in
/var/www/vhosts/xxx/httpdocs/memberportal
and git is setup in/var/www/vhosts/xxx/git/memberportal.git#
If I go to my webdirectory in
/var/www/vhosts/xxx/httpdocs/memberportal
I can call git like this:However, whenever I pull from the repository, all modified files will be deleted on the plesk host. This means if you use a webhook to automatically deploy, the edits on your production server may get deleted before you can push them to your repository.
you can zip and download website folder from server and unzip it to localhost and push it to git.
The way I use to solve this is almost-like the Adam’s approach. The only one difference is that instead of work in the working directory, I run
git
from .git directory with the--work-tree
parameter.Lately, I’m wondering about if do it throught git patchs instead of pushing from plesk is a better solution. Any ideas or how-to’s?
Edit: I’ve ended going with the git patch way. For this, I’ve an alias who runs
Then, I apply the patch to the local repo and commit & push the changes.