将数据推送到裸 git repo 时,如何自动将数据推送到 git-repo?
gitrepo - the name of my bare repo, I push to this repo from my desktop
sandbox - the name of a git repo, should automatically contain up-to-date data
每次推送到 gitrepo 后,沙箱存储库应自动包含最新数据。
我考虑过不使用裸仓库直接推送到沙箱,不可能推送到非裸git仓库。所以人们推荐的解决方案是一个 post-receive 钩子,它将使数据在 /etc/puppet/environments/sandbox/ 下可用。
[root@puppet environments]# cat gitrepo/hooks/post-receive
#!/bin/sh
cd /etc/puppet/environments/sandbox/
git pull origin
[root@puppet environments]#
不幸的是,这个钩子也没有做任何事情。我已经查看了http://bare-vs-nonbare.gitrecipes.de/提供的示例( http://utsl.gen.nz/git/post-update),但我简直不敢相信这么简单的事情自动将 repo-commits 推送到另一个 repo 需要 86 行代码。