简体   繁体   English

使用Git与多个提交者一起部署网站

[英]Deploy Website using Git with multiple committers

I want to run a dokuwiki.org on my server. 我想在我的服务器上运行dokuwiki.org I'm using the file-based setting so there's no external database involved. 我正在使用基于文件的设置,因此不涉及外部数据库。

I want to setup a git repository with contains dokuwiki's data directory so multiple committers are able to work offline and push the changes back when they are done. 我想设置一个包含dokuwiki data目录的git存储库,这样多个提交者就可以脱机工作并在完成后推送更改。 The data directory in the git repository is no big deal, you can set the location of the data directory using dokuwiki's config-files. git存储库中的data目录没什么大不了的,你可以使用dokuwiki的config-files设置data目录的位置。

I used this guide to set everything up and it's working as expected. 我使用指南来设置所有内容,并且它按预期工作。

tl;dr of the guide: tl;指南博士:

  • setup bare repo 设置bare仓库
  • post-receive hook on the bare repo to navigate to the htdocs directory and checkout the changes from the bare repo. 在裸仓库上的post-receive hook导航到htdocs目录并检查来自bare仓库的更改。
  • you push something to the repo, and the htdocs directory automatically checksout the changes from the repo. 你推送一些东西到repo, htdocs目录自动检查repo的变化。

So the guide is only useful if you are using it for a static site or something database based. 因此,只有在将静态站点或基于数据库的内容用于指南时,该指南才有用。

My problem is that the www directory is changed everytime someone edits something via the web-based wiki and not the files in their local repository -> the changes don't get pushed back to the bare repository because there's no hook/way/...to do that. 我的问题是,每当有人通过基于Web的维基而不是本地存储库中的文件编辑某些东西时, www目录就会被更改 - >这些更改不会被推回到bare存储库,因为没有挂钩/方式/ .. 。要做到这一点。

Is there anything i'm missing here or a better way to handle this usecase? 有没有我在这里缺少或更好的方法来处理这个用例?

The only thing coming to my mind is to have the website be a repository itself (call it the www repo), and people pull from it before the developers pushes. 我想到的唯一一件事就是让网站本身就是一个存储库(称之为www repo),人们在开发人员推动之前就将其从中拉出来。 You can use the git plugin to commit changes that happened on the website. 您可以使用git插件提交网站上发生的更改。

This has drawbacks because you have to change how you set up hooks. 这有缺点,因为您必须更改设置挂钩的方式。 Basically when someone pushes to the bare repository you'll have to check in your hook that last modifications made via the web-interface has been committed to www repo (which means that its working tree is clean), and that the commits being pushed contain them (ie they have pulled from the website repo). 基本上当有人推送到裸存储库时,你必须检查你的钩子,通过web界面进行的最后修改已经提交到www repo(这意味着它的工作树是干净的),并且提交被推送包含他们(即他们从网站回购)。 If yes, then the hook of your bare repository pushes the new commits to the www repo. 如果是,那么裸存储库的钩子将新提交推送到www repo。

However I have no idea if this is feasible, and what quality the git plugin is. 但是我不知道这是否可行,以及git插件的质量。 But I don't see anything else to make Git work with external modifications that are not commits. 但我没有看到任何其他东西让Git使用非提交的外部修改。

There is a fairly new plugin which does exactly what you need: gitbackend . 有一个相当新的插件可以完全满足您的需求: gitbackend It also supports pulling into the live repo. 它还支持拉入现场回购。

It is not apparent from your description, but in case you plan to "only" change what's in data/pages and data/media , you would be missing the changes to the meta data. 从您的描述中不明显,但如果您计划“仅”更改data/pagesdata/media ,您将错过对元数据的更改。 That means that several commits would only appear as a single revision on the old revisions of a page and other data like commit messages / change summary would be missing. 这意味着几个提交只会在页面的旧版本上显示为单个修订,而其他数据(如提交消息/更改摘要)将丢失。

The aforementioned plugin hasn't implemented the meta data changes either, but could do it internally. 上述插件也未实现元数据更改,但可以在内部执行。 If you'd rather like to write a script which does something externally, you might want to hook into the XML-RPC API . 如果您更喜欢编写一个在外部执行某些操作的脚本,您可能希望挂钩到XML-RPC API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM