我想将我的版本自动化到暂存和实时环境,当我推送到我的临时分支时,我希望我的登台服务器可以拉动并更新它的代码库 .

我的存储库存在于bitbucket上,我正在尝试使用webhooks触发存储库推送 .

我已将我的公钥添加到bitbucket上的SSH密钥,我可以ssh到我的服务器上,然后通过ssh访问bitbubcket,但是,每当我执行推送时,我的webhook日志显示错误401,我不确定我是什么做错了?

这是webhook的错误代码(或者如果它得到401的错误),

<?php

/*
Read the raw POST data.
*/
$json = file_get_contents('php://input');
if( ! $json)
{
    echo "not json";
    exit;
}

/*
Here we're allowing for the fact that Bitbucket 'POST' hooks and Bitbucket 'Pull Request POST' hooks were developed at different times and
send the data in different ways. Here's an explanation http://tinyurl.com/m96th4j
*/
if( $_SERVER['CONTENT_TYPE'] == 'application/json')
{
    $payload = json_decode($json);
}
else 
{
    $payload = json_decode(urldecode(substr($json, 8)));
}

if(is_null($payload))
{
    exit;
}

/*
Here we just sift through the payload and see if we have recieved a pull request merge (and the branch is 'release-candidate') OR
we have received a commit (and the branch is 'release-candidate')
*/
if((isset($payload->pullrequest_merged) && $payload->pullrequest_merged->destination->branch->name == 'dev-master') || (isset($payload->commits) && $payload->commits[0]->branch == 'dev-master'))
{
    /*
    Run the command to navigate to the website
    root and perform the git pull
    */
    echo "hello";
    system('cd /var/www/vhosts/popsapp.com/dev.popsapp.com && git pull');
}

我做错了吗?如果有一种方法可以找到我被拒绝访问我的开发服务器时访问我的bitbucket的原因?