📚Miscellaneous
Auto-restarting your bot on git pull
Add your GitHub repository as the remote origin:
Create a new file in the hooks directory of your Git repository:
Add the following code to the post-merge file:
Save and close the file.
Make the file executable:
Every time you run git pull
, it will automatically run the post-merge hook and pull the latest changes from your GitHub repository. The bot will also be restarted automatically using PM2.
NOTE:
If you want to use git pull
to update your code automatically, you must keep your GitHub repository public. If you're going to keep your code private, consider using a different method, such as deploying from your machine or using a continuous integration/continuous delivery (CI/CD) tool such as Jenkins, TravisCI, CircleCI, etc.
These tools allow you to securely deploy code from a private repository without exposing it publicly.
Last updated