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?
4
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
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.
even for the subdomain. Hope that helps someone else.
Check if you are in the right folder (as I show here)
Then check your environment variables (seen here):
GIT_DIR
orGIT_WORK_TREE
, as set by Plex, to make sure they are not interfering.For me Niklas answer did not work unless I did a cd into the worktree directory. You can add this to the git command itself (using
-C
). Also I have added a sync command, in case the submodules origin changes:I want to also note, that using variables did not work for me, I had to use absolute path for both commands.
Note: My hoster is netcup.com, maybe that is a specific issue on their side, but I guess it is relevant for all plesk installations.
Although it’s been a while here my two cents.
I’m glad the given answers where pointing me in the right direction, however I still had to struggle with this quite some time.
Here is my summary:
Using submodules in Plesk
ssh
! To integrate an external repo we must usehttps
protocol:git submodule add https://github.com/example.repo.git
– see https://github.com/docker-library/golang/issues/148ssh
into your account using the${HOME}
users name and password. In Plesk the${HOME}
user is the owner of the subscriptiondomain.com
orsub.domain.com
belongs to.${HOME}/.ssh/id_rsa
and${HOME}/.ssh/id_rsa.pub
Usage
(under "Additional deployment actions")
or the short way
Explanation: we must use
--git-dir
and--work-tree
here because of Plesks folder structure. Normally.git
files are located within the main repository folder. Here these files are in its owngit
folder: