git push到var / www / application [英] git push to var/www/application

查看:148
本文介绍了git push到var / www / application的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的朋友和我想使用CodeIgniter PHP框架做一个网站。我们租用一个运行Cent OS 6.4的VPS。

My friends and I want to make a website using the CodeIgniter PHP framework. We rent a VPS which runs Cent OS 6.4.

当我们开发网站时,我们遇到了一个问题:当用户A改变了var / www /通知B和C他已经改变了什么,然后B和C必须下载新版本,并尝试找出新文件和旧文件之间的差异(特别是当这个文件也被B或C改变了同时)。我们设法使用git来解决这个问题。我们在服务器中安装了gitolite。

As we developed the website, we met a problem: After user A changed something in var/www/application, A must inform B and C that he has changed something, and B and C must then download the new version and try to find out the difference between the new file and the old file (especially when this file had also been changed by B or C at the same time). We managed to use git to solve this problem. We installed gitolite in the server.

但是,我们现在有另一个问题:在我们推送更改后,我们要将文件直接推送到var / www /我们可以直接在浏览器中测试它。

However, we now have another problem: after we push changes, we want to push the file directly into var/www/application, so we can test it directly in browsers.

我的问题是,


  1. 可以直接进入var / www / application?

  2. 我该如何做?

  3. 我的意思是什么样的信息应该放在下面的形式(我不能上传图片)
    位置
    url:
    host:
    存储库路径:

用户:
密码:

user: password:

推荐答案

听起来你想要使用Git进行部署。 git push 是你用来推送到远程仓库,而不是某个目录。你真正需要的是一个脚本,它执行 git pull ,然后可能一个 git checkout 来获取更新的代码从repo,并切换到任何分支,你使用部署(除非你使用master,那么你可以只是保持主人的所有时间)。

It sounds like you're wanting to use Git for deployment. git push is what you use to push to a remote repo, not to some directory somewhere. What you really need is a script that does a git pull, and then possibly a git checkout to fetch the updated code from the repo, and switch to whatever branch you're using for deployment (unless you use master, then you can just stay on master all the time).

根据您在其中托管您的repo,您​​可以设置一个钩子,以便它可以在新代码准备抓取时在您的服务器上访问一个URL。

Depending on where you host your repo, you can set up a hook so that it will hit a URL on your server when new code is ready to grab.

这篇关于git push到var / www / application的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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