Deploy a project using Git push

后端 未结 19 895
囚心锁ツ
囚心锁ツ 2020-11-22 07:06

Is it possible to deploy a website using git push? I have a hunch it has something to do with using git hooks to perform a git reset --hard on the

相关标签:
19条回答
  • 2020-11-22 08:06

    I found this script on this site and it seems to work quite well.

    1. Copy over your .git directory to your web server
    2. On your local copy, modify your .git/config file and add your web server as a remote:

      [remote "production"]
          url = username@webserver:/path/to/htdocs/.git
      
    3. On the server, replace .git/hooks/post-update with this file (in the answer below)

    4. Add execute access to the file (again, on the server):

      chmod +x .git/hooks/post-update
      
    5. Now, just locally push to your web server and it should automatically update the working copy:

      git push production
      
    0 讨论(0)
提交回复
热议问题