如何每天自动更新我的服务器文件 [英] How to update my server files from a git repo automatically everyday

查看:606
本文介绍了如何每天自动更新我的服务器文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这些与服务器相关的工作中,我是一个noob。我在本地系统中编写了一些PHP代码,并定期更新我在github中的回购。每次我想测试我的应用程序时,我都将通过FTP将本地系统中的所有文件复制到我的服务器上,然后执行此操作。现在我想知道是否有自动进行提交的方式来反映服务器中的文件。有没有办法自动让服务器定期从repo获取文件? (比如每天一次)。



这可以通过其他方式完成,就像我从本地计算机进行推送时一样,回购库会更新,然后文件就会打开我的服务器详细信息:Apache 2.2.15,架构i686与Linux内核2.6.18-194.32.1.el5

解决方案

如果你有cronjob,你可以使用它们。首先在您的服务器上设置存储库。然后你可以设置cronjob,选择一个执行时间,然后在cronjob中执行以下命令: c> cd your / repository /文件夹; git pull master origin


I am a noob in these server related work. I am writing some PHP code in my local system and has been updating my repo in github regularly. Each time I want to test my application, I copy all the files from my local system onto my server through FTP and then do it. Now I want to know whether is there a way to automatically make the commits that I make to reflect in the files in the server. Is there a way to automatically make the server get the files from the repo periodically? (say, once everyday).

Can this be done other way, like when I make a push from my local machine, the repo gets updated and in turn the files on the server also get updated?

My Server Details: Apache 2.2.15, Architecture i686 with Linux Kernel 2.6.18-194.32.1.el5

解决方案

If you have cronjobs you can use them. First set up the repository on your server. Then you can set up the cronjob, choose a time in which it should be executed, and then in the cronjob execute the following command:

cd your/repository/folder; git pull master origin

这篇关于如何每天自动更新我的服务器文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆