Symptoms:
1) ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://x@x:7990/bitbucket/scm/x/x.git'
I also get the warning:
2) Git hook scripts are not executing
In the BitBucket support page
3) In atlassian-bitbucket.log
2018-08-07 08:10:25,175 WARN [http-nio-7990-exec-9] "POST /scm/fixa/repo.git/git-receive-pack HTTP/1.1" c.a.s.i.s.g.p.http.HttpReceivePack PROJ/repo[1]: 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 details
But the link only refer to chmod stuff in Linux, and I made sure that bitbucket user have access to the ApplicationData folder.
4)
I see all the githook files, but when I try to run them in git-bash
user@COMPUTER MINGW64
/c/Atlassian/ApplicationData/Bitbucket/shared/data/repositories/1/hooks (BARE:master)
$ ./pre-receive
./pre-receive: line 9: /c/Atlassian/ApplicationData/Bitbucket/shared/data/reposi tories/1/hooks/hooks/pre-receive.d: No such file or directory
Note the extra hooks in the path. If I manually remove this in the pre-receive script I get:
$ ./pre-receive./pre-receive: line 11: exec: pre-receive.d: cannot execute: Is a directory
#!/usr/bin/env bash
#>*******************************************************
# THIS FILE WAS AUTO-GENERATED BY ATLASSIAN BITBUCKET.
# IT CONTAINS NO USER-SERVICEABLE PARTS.
#>*******************************************************
if [[ "$OSTYPE" == "cygwin" ]]; then
exec $(cygpath $STASH_HOOK_COORDINATOR) hooks/pre-receive.d "$@" <&0 >&1 2>&2
else
exec $STASH_HOOK_COORDINATOR hooks/pre-receive.d "$@" <&0 >&1 2>&2
fi
Hooks location
Above is the default pre-receive scrip
5)
C:\Atlassian\ApplicationData\Bitbucket\shared\data\repositories\1\hooks
I made sure that the bitbucket owner account have full rights to the folders
This is repeated for every new repo I create.
What bash/git instance bitbucket supposed to use? Its own or a pre-install one? Could it be a problem with previous installations of git on the server prior to bitbucket?
Thank you for any help