Is it a bad idea to have Git repository in production server

痴心易碎 提交于 2021-02-08 06:29:14

问题


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?


回答1:


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.

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.

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

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.

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




回答2:


No, I think not Heroku servers are fine with github, but push carefully and work on branches not on master directly.



来源:https://stackoverflow.com/questions/30846167/is-it-a-bad-idea-to-have-git-repository-in-production-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!