Question
How to commit and push website files to the local Plesk Git repository?
Answer
-
Log into Plesk;
-
Create a new local Git repository in Plesk > Domains > example.com > Git > Add Repository:
-
Connect to the server via SSH;
-
Navigate to the subscription's directory:
# cd /var/www/vhosts/example.com
-
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.
-
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
-
Navigate to Plesk > Domains > example.com > Git and select master branch in Change branch and path: