GIT implements automatic code pull (automatic deployment)

1. Use crontab to schedule tasks

  1. To edit a user's scheduled task:
    1. crontab -e
  2. Write timed commands in user timed task files
    1. Execute the following command every 1 minute:*/1 * * * * cd /home/wwwroot/default/GIT/autoload;/usr/local/bin/git pull
      1. cd /home/wwwroot/default/GIT/autoloadIndicates entering the git project directory
      2. /usr/local/bin/git pullAfter entering the project directory, pull the code

2. Use PHP script to pull (this method can be used if the git server has a prompt function)

  1. The code content in the php file (provided that the exec function needs to be supported):
exec("cd /home/wwwroot/default/GIT/autoload;/usr/local/bin/git pull");

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325648999&siteId=291194637