Unable to run custom git hook

I’ve added a custom post-receive git hook, but GitLab has trouble running it.

The hook fires when expected, and it works if executed through command line. However, when the repo is updated the hook does not succeed.

post-receive git hook source:

#!/bin/sh

git push --tags --repo https://remote-git-repo.com/foobar.git

Solved: forgot to make sure the git credential helper could be accessed from within the hook

Leaving this here in case someone runs into the same issue as me…

The problem was the $PATH variable did not include /usr/local/bin, which was necessary for the git push command to succeed, since it used a git credential helper to authenticate with the remote repo I was pushing to from within the hook.