Plesk会根据git存储库更改自动更新子模块

时间:2018-11-11 23:18:20

标签: git git-submodules plesk

我已经将plesk网站设置为通过here中所述的后钩,将更改从远程存储库自动拉到Web服务器的特定路径。

但是我的存储库包含一个git子模块,我还需要运行自定义命令git submodule update --remote。我如何告诉plesk做到这一点。我可以在

中输入的命令
  

启用其他部署操作

似乎没有在正确的路径中执行设置。另外,当我转到存储库同步到服务器上的路径时,我得到:

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

我怎么能告诉plesk也使用git插件更新子模块?

3 个答案:

答案 0 :(得分:2)

就我而言,这是两个问题。这是子域的设置,文件夹结构在plesk中有所不同。

首先,我必须将“其他部署操作”设置为

# 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

第二个问题是子模块放置在github上,因此我必须将特定的子域ssh-key添加到github。可以在其中找到。

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

甚至对于子域。希望对别人有帮助。

答案 1 :(得分:1)

检查您是否位于正确的文件夹(as I show here

然后检查环境变量(seen here):GIT_DIRGIT_WORK_TREE(由Plex设置),以确保它们没有干扰。

答案 2 :(得分:0)

对我来说,除非我在工作树目录中输入cd,否则Niklas的答案将不起作用。您可以将其添加到git命令本身(使用-C)。另外,如果子模块的原点发生更改,我还添加了同步命令:

git --git-dir=/git/repo_name.git --work-tree=. -C /httpdocs/website submodule sync --recursive
git --git-dir=/git/repo_name.git --work-tree=. -C /httpdocs/website submodule update --init --recursive

我还要指出,使用变量对我不起作用,我必须对两个命令都使用绝对路径。

注意:我的托管人是netcup.com,也许这是他们的特定问题,但我想它与所有plesk安装都有关。

相关问题