代码之家  ›  专栏  ›  技术社区  ›  niklas

Plesk在git存储库更改时自动更新子模块

  •  2
  • niklas  · 技术社区  · 7 年前

    我已经设置了我的plesk网站,通过post钩子自动将更改从远程存储库拉到Web服务器的特定路径,如前所述 here .

    git submodule update --remote 也我怎么能让普莱斯克这么做呢。我可以在中输入的命令

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

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

    2 回复  |  直到 7 年前
        1
  •  5
  •   niklas    7 年前

    就我而言,这是两个问题。这是子域的设置,其中folderstructure在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上,因此我必须向github添加特定的子域ssh密钥。可以在中找到它。

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

    即使对于子域也是如此。希望这能帮助别人。

        2
  •  2
  •   VonC    7 年前

    检查您是否在正确的文件夹中( as I show here )

    seen here ): GIT_DIR 或 GIT_WORK_TREE

        3
  •  0
  •   NicoHood    5 年前

    对我来说,Niklas的答案不起作用,除非我将cd放入工作树目录。您可以将其添加到git命令本身(使用 -C ). 此外,我还添加了一个sync命令,以防子模块原点发生变化:

    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安装相关。