将GitHub文件(和更新)放到Ubuntu Web服务器上 [英] Getting GitHub files (and updates) onto an Ubuntu web server

查看:120
本文介绍了将GitHub文件(和更新)放到Ubuntu Web服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个多用户,多服务器的环境。所有开发人员都会使用Git并从GitHub等克隆各种回购站(在我控制的一个帐户中)。



现在,我如何从GitHub获取文件到服务器其中5个)?

首先,我正想着某种自动化的方式将更新从GutHub推送到服务器,但现在我想我可能更喜欢运行每个服务器的命令行上的东西来从GitHub'拉'更新。这个选项似乎不是完成的方式。



我可以不只是在Linux服务器上安装Git(用于提供网络文件),然后使用Git拉到拉他们(即就像任何用于开发计算机)?

大多数人如何获得GitHub文件到他们的网络服务器?

解决方案


大多数人如何将GitHub文件添加到他们的Web服务器?


一般通过推送至裸回购,然后在 post-receive 挂钩上准备结帐以回购现场工作树,类似于:

  git --git-dir = / path / to / bare_repo.git --work- tree = / path / to / website / httpdocs checkout -f 

您也可以从裸回购本身,通过 cron作业

  * / 10 * * * * user /home/usern/git-pull-requests/fetch.sh 






但是pull或push表示git安装在服务器上。



如果你不想这样,你可以使用 git archive 来创建一个存档(zip或tar),并将其复制到自定义脚本中以解压缩。


I'm setting up a multi-user, multi-server environment. All developers will use Git and clone various repos from GitHub etc. (in one account I control).

Now, how do I get files from GitHub to the servers (about 5 of them)?

First I was thinking of some sort of automated way to push updates from GutHub to the servers, but now I'm thinking I might prefer to run something on the command line of each server to 'pull' the updates from GitHub. This option doesn't seem to be the done way.

Can I not just install Git on a Linux sever (that I use for serving web files) and then use Git pull to pull them in (i.e. just like any computer used for developing)?

How do most people get GitHub files to their web servers?

解决方案

How do most people get GitHub files to their web servers?

Generally by pushing to a bare repo on the web server, with a post-receive hook ready to checkout that repo on the site working tree, similar to:

git --git-dir=/path/to/bare_repo.git --work-tree=/path/to/website/httpdocs checkout -f

You can also pull from the bare repo itself, through a cron job for instance:

*/10 * * * * user /home/usern/git-pull-requests/fetch.sh


But pull or push mean that git is installed on the server.

If you don't want that, you can use git archive to create an archive (zip or tar), and copy over that for a custom script to uncompress it.

这篇关于将GitHub文件(和更新)放到Ubuntu Web服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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