当我推送到Bitbucket时,一个钩子可以让VPS'拉'出来 [英] A hook that let `pull` from VPS when I `push` to Bitbucket
问题描述
每次我拉
回购。
我想自动执行。
如果我运行git deamon myown,我找到了一个解决方案。 但我想使用Bitbucket,因为它也可以作为备份。 我发现关于bitbucket的钩子的文档,但我无法找到如何去做。 任何人都可以给我看一个解决方案吗? 我对此做了一个非常基本的教程: de / 2013/04 / post-hook-for-git-bitbucketorg.htmlrel =nofollow noreferrer> http://jan1337z.blogspot.de/2013/04/post-hook-for-git-bitbucketorg.html
推送到服务器后执行自动拉取请求
https://confluence.atlassian.com/display/BITBUCKET/管理+ Bitbucket +钩子
这个基本步骤是:
$ ol
(Repository - >设置 - >部署密钥)
是apache2用户)
- > admin - > Hooks - > POST)
无法找到管理员?
(在bitbucket上)它的齿轮在右上角。点击它或键入'r',然后'a'。
基本的PHP脚本来拉取:
<?php
$ output = shell_exec('git pull');
echo< pre> $ output< / pre>;
?>
我这样做只是为了证明它是可能的。改进它:)
如何创建部署密钥(步骤2):
I'm managing my wordpress template in Bitbucket.
Each time I push
the theme, I must log in my VPS server and pull
the repo.
I want to do it automatically.
I found a solution if I run git deamon myown. Do an automatic pull request after pushing to server
But I want to use Bitbucket because it works as a backup also.
I found a Document about bitbucket's hook, but I could't find how to do it. https://confluence.atlassian.com/display/BITBUCKET/Manage+Bitbucket+hooks
Could anyone show me a solution?
I did a very basic tutorial on this:
this basic steps are:
- Create a Read-Only access to the Repository with a public-key pair.
- Add the public key as a deployment key to your repository (Repository -> Settings -> Deployment keys)
- Pull your Repository to your WebServer via SSH
- Change ownership of the git-folder (you pulled) to www-data (as this is the apache2 user)
- Create a public accessable php script that executed a git pull
- Place a POST-hook to your php-pull-script on your Server (Repository -> admin -> Hooks -> POST)
Cant find admin?
while you are on your repository (on bitbucket) its the gearwheel in the top right. Either click on it or type 'r' and then 'a'.
Basic PHP script to make the pull:
<?php $output = shell_exec('git pull'); echo "<pre>$output</pre>"; ?>
I had this running just to proof that it is possible. Improve it :)
How to create a deployment key (step 2):
这篇关于当我推送到Bitbucket时,一个钩子可以让VPS'拉'出来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!