I've seen similar questions on SE, but the solutions haven't worked for me, which I'll get to later.

I have SSH access to my cPanel account and can log in via SSH fine. I made a new repo via cPanel, which makes a new repo with the receive.denycurrentbranch setting set to updateInstead.

Note that the server and my local installation of git is git version 2.23.0 and 2.25.0.windows.1 respectively and therefore support updateInstead.

I then clone the repo from the source:

git clone ssh://user@domain.com/home/user/repo

Then I make some changes, commit them and try to push them.

When I try to push from my computer to the server, I get the following error message that I haven't been able to deal with:

stdin: is not a tty
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 really want this to work with this setting, cause then I would be able to just push everything up, however the solution that I've seen proposed doesn't work either, which is to make the repository bare and then change the value of denycurrentbranch to false. This does work for commits, however the files themselves never get put into the main /repo/ folder on the server.

I am running cPanel version 84.0.21.


This caused me much headache, and I still don't have a complete solution for it yet. However, I have found a way that made git deployment to cPanel possible, which I will list out in short:

Make a bare git repo at /home/user/repo

git init --bare

Here we don't need receive.denycurrentbranch set to updateInstead so just leave it unspecified.

Put a file called "post-receive" in repo/hooks with the following text:

git --work-tree=/home/user/public_html --git-dir=/home/user/repo checkout -f

Make sure not to use any newline after the script and notice that there is no #!/bin/bash before the script. The reason is because then you don't have to make sure it is the right bash, and more importantly, if you're writing on Windows then you have to make sure that you are using Unix line endings. Hopefully now this should all work after a git push.

  • Did you found the solution @npbm ? – Aman Jham May 17 '20 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.