0

I have a git bare repository on my server which has a post-receive hook that essentially does

GIT_WORK_TREE=`/path/to/public_html` git checkout -f

Whenever I do a push from my local repo to this remote I get an error:

fatal: bad config value for 'receive.denycurrentbranch' in ./config
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists

I found a solution for this which works fine. However, I cannot expect to type out the --exec=/usr/local/cpanel/3rdparty/bin/git-receive-pack each time I make a push. I know one option would be to make an alias to the whole command but that doesn't work great either since when I shift to a different system I need to have this command as well.

How do I go about enforcing that the right receive pack is used? The issue seems to be that I'm using a shared hosting which uses cPanel. Is there anything I can specify on my bare repo to ensure I can normally do git push origin master rather than specifying the pack? Or something that can be done on client side and stored into the main repo also works--as long as when I clone back the repo on another system I can continue using it normally. Suggestions?

Saifur Rahman Mohsin
  • 929
  • 1
  • 11
  • 37
  • 1
    [`git config remote..receivepack`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-remoteltnamegtreceivepack) – phd Sep 28 '20 at 16:00
  • Yes, I had seen this one but it doesn't seem like something that can be stored in github and restored automatically during a clone. – Saifur Rahman Mohsin Sep 29 '20 at 13:28

0 Answers0