skip to Main Content

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


  1. Chosen as BEST ANSWER

    According to a member of the Plesk Team :

    When you use remote repository, the following scenario is assumed - you send the changes to this remote repository, and then Plesk pulls them from the remote repository and deploys them to your web site.

    Commit or Push functionality is available in case of scenario when you send the changes from your local repository to Plesk, and then Plesk deploys the changes to your web site.

    see : https://talk.plesk.com/threads/commit-changes-made-on-the-server-with-git-extension-for-plesk-onyx.342362/#post-822292


  2. 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.

    Login or Signup to reply.
  3. 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:

    git --git-dir ../../git/memberportal.git --work-tree . add .  
    git --git-dir ../../git/memberportal.git --work-tree . status  
    git --git-dir ../../git/memberportal.git --work-tree . commit -m "My message"
    git --git-dir ../../git/memberportal.git --work-tree . push  
    

    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.

    Login or Signup to reply.
  4. you can zip and download website folder from server and unzip it to localhost and push it to git.

    Login or Signup to reply.
  5. 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.

    git --work-tree=/var/www/vhosts/xxx/yyy/ <any git command>
    

    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

    git --work-tree=/var/www/vhosts/project/public_folder --git-dir=/var/www/vhosts/project/git/project.git/ diff > patch-<project>-<now>.patch
    

    Then, I apply the patch to the local repo and commit & push the changes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search