8I am trying to update my cpanel through Github repositories.
Let me explain what I tried :
Step 1: At First, I created a Private Repository in Github
Step 2: Cloned the repositories in my local computer
Step 3: added all the files pushed in GitHub Repository ( Successfully uploaded with the commit message"
Step 4 : created a .cpanel.yml inside project folder.
.cpanel.yml code below
---
deployment:
tasks:
- export DEPLOYPATH=/home/cpanelUserName/public_html
- /bin/cp * $DEPLOYPATH
- /bin/cp/ -r * $DEPLOYPATH
- /bin/chmod 755 ${DEPLOYPATH}
- /bin/find ${DEPLOYPATH} -type d -exec /bin/chmod 755 '{}' \;
- /bin/find ${DEPLOYPATH} -type f -exec /bin/chmod 644 '{}' \;
Step 5: Pushed in Github repository ( Successfully added)
Now i logged in inside my cpanel. Clicked on Git Version Control.
Created a Repository
Step 6: I created a private key through ssh from the Cpanel ssh panel. And added in Github Repository Deploy key.
Step 7 : I just added the cpanel repository ssh url with my github repository using this command
git remote add server ssh://[email protected]:21098/home/myUserName/repositories/myportfolio
Step 8: I changed the web.php file & added it to the GitHub repository. (Successfully) Step 9: I tried to upload the changes to Cpanel through this command
git push server
#Note: asked for Cpanel password. When the password is valid it's uploading the changes inside repositories/myportfolio directory.
Repositories/myportfolio directory inside /home/myUsername directory. I mean outside of the public_html directory.
I can able to change the repository folder. But, .cpanel.yml file not working properly.
What to do now?
.cpanel.yml runs when server clones a repository and try to deploy after fetching new update.
You are pushing your repository from your computer.
You should use post-receive hook instead.