推送到服务器后执行自动拉取请求 [英] Do an automatic pull request after pushing to server
问题描述
我已经在 vps 服务器上安装了 gitlab,这也是我提交本地更改的远程服务器.
I have installed gitlab on a vps server which is also my remote for committing my local changes.
当我提交并推送到服务器(git@domain.com:root/project.git)时,代码将被更新.
When i commit and push to the server (git@domain.com:root/project.git), the code will be updated.
在我的 vps 上,我有这个工作流程:
On my vps i have this workflow:
- var/www/
- project (created through git clone git@domain.com:root/project.git)
- Files within the project
当我推送到服务器时,我想让服务器自动从 gitlab 中提取更改.我也尝试过使用更新后挂钩,但这不起作用.
When i do a push to the server, i want to let the server automatic pull the changes from gitlab. I also did a try with post-update hooks, but that doesn't work.
我必须创建一个裸仓库吗?还是我忘记了什么?
Do i have to create a bare repo ? Or did i forget something?
推荐答案
project.git 是一个bare repo,所以如果你有gitlab服务器的访问权限,可以去~git/repositories/root/project.git/hooks
并添加您的 post-receive
挂钩以强制部署.
project.git is a bare repo, so if you have access to the gitlab server, you can go to ~git/repositories/root/project.git/hooks
and add your post-receive
hook in order to force a deployment.
例如,请参阅通过 git/gitolite 权限错误部署网站/webapp"中的示例.
See an example in "deploying a website/webapp via git/gitolite permissions error" for instance.
这篇关于推送到服务器后执行自动拉取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!