Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Repository hooks won't execute after server migration

Andrew Mackintosh October 10, 2017

I recently moved a Bitbucket Server instance to a new machine using the supported process (which actually went perfectly, rather impressed!) from a Windows machine to a Linux one.

After migrating the repositories the execute permissions were not set on the hooks in the BITBUCKET_HOME\shared\data\repositories\xx\hooks\ directory, which I have updated as per this article but they are still throwing the error:

2017-10-10 17:24:06,581 WARN  [ssh-scm-request-handler] andrew@example.com @@VJPR66x1044x4763x0 1n4f9dv 10.xx.xx.xx SSH - git-receive-pack '/prj/deploytest.git' c.a.s.i.s.g.p.ssh.SshReceivePack PRJ/deploy-test[28]: Git hooks have not been called. Please verify that the hooks are configured correctly - see https://confluence.atlassian.com/display/BITBUCKETSERVERKB/Git+hook+scripts+are+not+executing?utm_campaign=in-app-help&utm_medium=in-app-help&utm_source=stash for detail

If I create a new repository from scratch the hooks work fine, but for older repositories that I have added the execute permission on they will not trigger.

I have gathered the support bundle zip and I notice that for the newly created repository it shows

<repository-hooks>
<hook>
<key>com.atlassian.stash.plugin.stash-web-post-receive-hooks-plugin:postReceiveHook</key>
<config>true</config>
</hook>
</repository-hooks>
<git-hooks>
<hook>
<name>pre-receive</name>
<size>430 B</size>
<executable>true</executable>
<callbacks>
<callback>
<name>20_bitbucket_callback</name>
<size>416 B</size>
<executable>true</executable>
</callback>
</callbacks>
</hook>
<hook>
<name>post-receive</name>
<size>432 B</size>
<executable>true</executable>
<callbacks>
<callback>
<name>20_bitbucket_callback</name>
<size>418 B</size>
<executable>true</executable>
</callback>
</callbacks>
</hook>
</git-hooks>

While the affected repository shows:

<git-hooks>
<hook>
<name>pre-receive</name>
<size>430 B</size>
<executable>true</executable>
<callbacks>None</callbacks>
</hook>
<hook>
<name>post-receive</name>
<size>432 B</size>
<executable>true</executable>
<callbacks>None</callbacks>
</hook>
</git-hooks>

So the callbacks are set to None, despite the fact that the 20_bitbucket_callback files are present under both pre-receive and post-receive.

Is there any way that I can get the repository to pick up the callbacks value again?

1 answer

1 accepted

0 votes
Answer accepted
Andrew Mackintosh October 11, 2017

After a great deal of tinkering around, I tried coping the template hooks files from $BITBUCKET_HOME/shared/config/git/templates/hooks/ into the hooks directory of the repository and setting the ownership to atlbitbucket.

Since then, hooks have started working on this repository despite having the same contents and permissions as the old files. I suspect this may have been a character-encoding related issue between Windows and Linux, though it may well just be a mystery.

In any case, I have answered my own question!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events