Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plesk automatically update submodule on git repository change

I have setup my plesk website to automatically pull changes from a remote repository to a certain path of the webserver via post-hooks as described here.

However my repository contains a git submodule and I need to run the custom command git submodule update --remote as well. How can I tell plesk to do that. The commands I can enter in the

Enable Additional Deployment Actions

Setting seem not to be executed in the correct path. Also when I go to the path the repository syncs to on my server i get:

fatal: Not a git repository (or any of the parent directories): .git

How can I achive to tell plesk to update submodules too with the git plugin?

like image 727
niklas Avatar asked Nov 11 '18 23:11

niklas


2 Answers

In my case it was two problems. It was a setting for a subdomain, where the folderstructure is different in plesk.

First I had to set the "Additional Deployment Action" to

# find the correct git folders / repositorys by ssh-ing onto your server
git --git-dir=/var/www/vhosts/example.com/git/example.git --work-tree=/var/www/vhosts/example.com/subdomain.example.com/path/to/working-directory/ submodule update --init --recursive

The second problem was that the submodule was placed on github, so I had to add the specific subdomain ssh-key to github. It can be found in.

/var/www/vhosts/example.com/.ssh/id_rsa.pub

even for the subdomain. Hope that helps someone else.

like image 166
niklas Avatar answered Oct 17 '22 14:10

niklas


Check if you are in the right folder (as I show here)

Then check your environment variables (seen here): GIT_DIR or GIT_WORK_TREE, as set by Plex, to make sure they are not interfering.

like image 41
VonC Avatar answered Oct 17 '22 13:10

VonC