Plesk

How to commit and push website files to the local Plesk Git repository?

Question

How to commit and push website files to the local Plesk Git repository?

Answer

  1. Log into Plesk;

  2. Create a new local Git repository in Plesk > Domains > example.com > Git > Add Repository:

  3. Connect to the server via SSH;

  4. Navigate to the subscription's directory:

    # cd /var/www/vhosts/example.com

  5. Add website's files to the repository and comit the changes:

    # git --git-dir ./git/example.git --work-tree ./httpdocs add --all

    # git --git-dir ./git/example.git --work-tree ./httpdocs commit -m 'Initial commit'

    Note: Where example.git is the name of the local repository created on step 2.

  6. Restore correct permissions as system user of the subscription:

    # chown -R $(plesk db -Ne 'select s.login from domains d, hosting h, sys_users s WHERE s.id=h.sys_user_id AND h.dom_id=d.id AND d.name="example.com"'):psacln ./git

  7. Navigate to Plesk > Domains > example.com > Git and select master branch in Change branch and path: