在生产服务器中拥有Git存储库是一个坏主意吗 [英] Is it a bad idea to have Git repository in production server

查看:58
本文介绍了在生产服务器中拥有Git存储库是一个坏主意吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有Windows Server 2012,Apache,PHP和MySQL.服务器有点乱.我想要做的一件事是跟踪代码上的更改.通常,我不在服务器上设置Git,而是在本地计算机上进行开发,然后使用SSH将更改部署到生产服务器上.但是,此Windows Server 2012不是我设置的,因此有点混乱.我无法复制PHP代码并在我的机器上开发它,因为它运行在PHP 5.2上并且代码已加密.因此,我认为我必须在生产服务器中设置Git.

We have a Windows Server 2012, Apache, PHP, and MySQL. The server is a bit a mess. One of the things that I want is to track the changes on the code. Normally I don't set up Git on the server, instead I develop on the local machine then using SSH I deploy changes to the production server. However this Windows Server 2012 was not set up by me and thus it is a bit mess. I cannot copy the PHP code and develop it in my machine because it runs on PHP 5.2 and the code is encrypted. Thus, I think I have to set up Git in the production server.

我想知道,那会不会有性能问题?

I wonder, then will there be performance problems?

推荐答案

从git(或至少某种形式的版本控制)存储库进行部署是每个地方的标准做法,但是无论您采用何种方式进行部署感觉像.

It's standard practice everywhere to deploy from a git (or at least some form of version control) repository, but the method of doing the deploy is pretty much whatever you feel like.

如果您具有存储已部署的每个版本的工作空间/文件夹,则可以将您的工作副本推送到生产环境中.

If you have workspaces/folders that store each version that has been deployed, it's fine to just push up your working copy to production.

一种模式是使用git标记您的发行版,并在服务器上直接检出发行版( git checkout v1.0.0 ),或使用git托管服务器的功能下载标记的tarball

One pattern is to tag your releases with git and check those out directly (git checkout v1.0.0) on the server, or to use a git hosting server's facilities to download a tarball of your tag.

例如,您可以像这样从github下载标签为 v1.0.0 的压缩包:

For example, you can download a tarball of the tag v1.0.0 from github like so:

https://github.com/<user>/<project>/archive/v1.0.0.tar.gz

在Windows服务器上运行单个(或多个;检出的工作副本不会带来任何开销)git repo没有性能开销,但是请注意,如果克隆,请不要暴露 .git 文件夹直接.

There's no performance overhead to running a single (or many; checked out working copies introduce no overhead) git repo on a windows server, but be careful not to expose the .git folder if you clone directly.

此外,切勿强行推送到您的 master (或同等级别)分支,否则您会遇到麻烦.

Also, never force push to your master (or equivalent) branch, or you're asking for trouble.

这篇关于在生产服务器中拥有Git存储库是一个坏主意吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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