简体   繁体   中英

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. I've always edited the production server using vim, and am moving away from doing that. I now have a git repo in my production folder, which I commit up to GitLab. ( git commit -a -m "Blah" , git push origin master ) But I'm still editing the live files. 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.

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. Hopefully that makes sense to you, I'm a total git newbie.

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. Staging and Production are on the same webserver, and I'll access staging through staging.domainname.com or similar.

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

And then "clone" (I guess) that repo into the Production folder, so that I can git pull into there.

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. 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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