Home  >  Q&A  >  body text

push代码到git后如何同步到服务器

push到git后还需要把git的文件上传到服务器才能在浏览器看效果,除了用scp手动上传有什么简便的办法?

高洛峰高洛峰2757 days ago698

reply all(4)I'll reply

  • 迷茫

    迷茫2017-04-25 09:06:18

    Use Hook. After the git push is completed, the hook is executed and the code is cloned to the server. https://developer.github.com/webhooks/#events

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-04-25 09:06:18

    Using Git to deploy a web site notes
    Using Git to manage a web site

    reply
    0
  • 怪我咯

    怪我咯2017-04-25 09:06:18

    I can understand your problem as a project (resource) deployment problem.

    Static resources

    If it’s just some pictures, HTML, js, CSS, etc., feel free to use Git Hook. Here is an introductory article.

    Project backend

    For example, if you write scripting languages ​​such as PHP, Node.js, Python or Ruby, and include database resources, and want to find a tool in addition to scp to upload source code to the server and deploy and run it, I recommend Capistrano. Here is a deployment article so you can get a feel for it. Now Capistrano has been released to the third edition, which is quite different from the second edition. Capistrano 2

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-04-25 09:06:18

    I usually make the upgrade package through git patch and put it on the update server, and then update it in the background

    reply
    0
  • Cancelreply