简体   繁体   English

如何在我的网站工作流程中添加登台平台-当前使用git但仍在生产中编辑实时文件

[英]How to add a staging platform into my website workflow - currently using git but still editing live files on production

I recently joined the 21st century and set up git on my webserver. 我最近加入21世纪,并在我的网络服务器上设置了git。 I've always edited the production server using vim, and am moving away from doing that. 我一直使用vim编辑生产服务器,并且不再这样做。 I now have a git repo in my production folder, which I commit up to GitLab. 现在,我的生产文件夹中有一个git repo,我将其提交给GitLab。 ( git commit -a -m "Blah" , git push origin master ) But I'm still editing the live files. git commit -a -m "Blah"git push origin master )但是我仍在编辑实时文件。 I have a local copy on my laptop too which I pull into PhpStorm, but haven't really utilised it at all yet as vim is too ingrained in me. 我在笔记本电脑上也有一个本地副本,我可以将其放入PhpStorm,但是由于vim根深蒂固,所以我还没有真正使用它。

At the moment I'm only using GitLab to track issues and my version history, I don't git pull anywhere from it, I just git push to it from production. 目前,我仅使用GitLab来跟踪问题和版本历史记录,我没有从它的任何位置git pull ,而是从生产中git push到它。 Hopefully that makes sense to you, I'm a total git newbie. 希望这对您有意义,我是git新手。

What I want to do today is create a staging version of the site. 我今天要做的是创建站点的暂存版本。 And then I plan to edit those files "live" instead of production. 然后,我计划“实时”编辑这些文件,而不是正式版。 Once I'm happy with something I'd like to git commit and git push to GitLab, and then git pull from GitLab to production. 一旦我对某些东西感到满意,我想git commitgit push到GitLab,然后git pull从GitLab到生产。 Staging and Production are on the same webserver, and I'll access staging through staging.domainname.com or similar. 暂存和生产都在同一台Web服务器上,我将通过staging.domainname.com或类似站点访问暂存。

So what I think I'd like to do is move the current git that exists inside /var/www/sites/production/.git to /var/www/sites/staging/.git 所以我想我想做的就是 /var/www/sites/production/.git中存在的当前git移到/var/www/sites/staging/.git中

And then "clone" (I guess) that repo into the Production folder, so that I can git pull into there. 然后将这个仓库“克隆”(我想)到Production文件夹中,这样我就可以git pull到那里了。

Is that right, or have I got this all muddled? 是这样吗,还是我把这些都弄糊涂了?

Thanks 谢谢

Assuming all the differences between your staging and production environments can be tracked within the Git repo, your current solution, ie, setting up a production directory that is only ever modified via git pull , seems fine. 假设可以在Git存储库中跟踪您的暂存环境和生产环境之间的所有差异,那么当前的解决方案(即,设置只能通过git pull修改过的生产目录)似乎很好。 There are myriad ways to go about configuring a workflow around staging/production/other environments, but sometimes the simplest solution is all you need. 有多种方法可以围绕登台/生产/其他环境配置工作流程,但是有时候,最简单的解决方案就是您所需要的。 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM