I am trying to automatically deploy code to a shared hosting account, using the Git™ Version Control feature of CPANEL.

I can see from the history of the remote repository, that my code does reach the remote. and I can see the message generated by the post-receive hook of the remote repository.

It says,

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 302 bytes | 302.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Recieved update on checked-out branch, queueing deployment.
remote: --- 
remote: apiversion: 3
remote: func: create
remote: module: VersionControlDeployment
remote: result: 
remote:   data: ~
remote:   errors: ~
remote:   messages: ~
remote:   metadata: {}
remote:   status: 1
remote:   warnings: ~
To ssh://my-domain.com/home/my-username/cicd
   7e20639..8ebdfb5  HEAD -> master

However, the deployment of files is not happening to the desired location.

Contents of my .cpanel.yml file are as below

    - export DEPLOYPATH=/home/my-username/public_html/cicd.my-domain.com/
    - /bin/cp index.html $DEPLOYPATH

Contents of my post receive hook are


# post-receive                                       Copyright 2018 cPanel, Inc.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

branch=$(/usr/local/cpanel/3rdparty/bin/git branch | awk '$1 == "*"{print $2}')
while read oldrev newrev ref
  if [ "x$ref" == "xrefs/heads/$branch" ]
    echo "Recieved update on checked-out branch, queueing deployment."
    (cd .. ; /usr/bin/uapi VersionControlDeployment create repository_root=$PWD)
done < /dev/stdin

Cpanel Documentation , says the "create" function will have log in the following location


but there is no logs/ folder in there.maybe i cant see it because its a shared hosting.

I updated the receive.denyCurrentBranch config item

Updated the git config settings receive.denyCurrentBranch of the remote branch from updateInstead to false. Because otherwise I was getting the following error while pushing.

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.

If it will help, my GIT remote version is 2.19.1


I've found if there are any untracked files in the repo directory the commands will not fire and you get the result you are seeing.

You can tell they did not fire because data: ~ instead of a list of log files.

Here is how to solve it:

  1. Go to your repo directory, in this case ssh://my-domain.com/home/my-username/cicd.
  2. Run git status to list any untracked files.
  3. Delete or commit any untracked files.
  4. Try again.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.