skip to Main Content

I am having issue while creating repo into public_html folder. It says error like this.

Error: You cannot use the “/home/clientresearch/public_html” directory because it already contains files.

Is there any way to create repo into cPanel where there is already files. Right now it is only working into clean directory.
How can we make the git repo have the all file like live site?

Thank you in advance

2

Answers


  1. You should keep the git clone and the public_html deployment folder separate.
    Cloning a source code base, and deploying its content are two separate steps.

    That way, you can follow the CPanel guide “Guide to Git – Deployment“, which includes:

    The .cpanel.yml file determines how and where the changed files deploy.

    You must check a .cpanel.yml file in to the top-level directory for each cPanel-managed repository that you wish to deploy.
    .cpanel.yml files must use the format in the example below.

    Important:

    The file below is only an example. You must update it to suit your needs. It will not allow you to deploy a repository successfully.

    The following .cpanel.yml file deploys the index.html and style.css files to the example account’s public_html directory:

    ---
    deployment:
      tasks:
        - export DEPLOYPATH=/home/user/public_html/
        - /bin/cp index.html $DEPLOYPATH
        - /bin/cp style.css $DEPLOYPATH
    

    If you want the full content of the repo to be deployed, then check out the “Automatic or push deployment” section

    cPanel’s Git Version Control feature (cPanel >> Home >> Files >> Git Version Control) automatically adds a post-receive hook to all cPanel-managed repositories.

    When you push changes directly to a cPanel-managed repository that includes a .cpanel.yml file, the hook deploys those changes automatically.
    For more information, read Git’s githooks documentation.

    https://documentation.cpanel.net/download/attachments/14002623/automatic_deployment.png?version=4&modificationDate=1539182581380&api=v2

    Login or Signup to reply.
  2. I created a git repository by using the “Git Version Control” GUI in CPanel. You just “create”, and then add whatever directory you would like to use under the “repository path”. Give it a name, and then hit create. You can then add this as a remote repo

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search