使用 Git 的生产和测试服务器

发布于 2024-08-31 18:24:01 字数 118 浏览 1 评论 0原文

我正在运行一个 PHP - MySQL 网站,并使用 Git 在我自己的服务器上设置了一个远程存储库。

我现在想要一种能够拥有生产和测试服务器的方法,以及如何能够轻松地将我的更改从开发推送到生产。并且无缝。

I am running a PHP - MySQL website, and have set up a remote repository on my own server using Git.

I now want a way to be able to have a production and a test server, and some how be able to push my changes from dev to production easily. and seamlessly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

讽刺将军 2024-09-07 18:24:01

请不要使用 git 进行部署。

设置就像通常的构建过程一样。构建一个 zip,进行缩小和 lint 以及一路上的朋友......并在单独的文件中进行配置。

并使用 BuildBot 或 Hudson 或其他任何工具来实现自动化。

子孙后代将会感谢您。

Please don't use git for deployment.

Setup, like, usual build proccess. Build a zip, do minification and lint and friends along the way...and have configuration in separate file.

And use BuildBot or Hudson or whatever to automate it.

Future generations will thank You.

洛阳烟雨空心柳 2024-09-07 18:24:01

您可以通过在生产服务器的存储库上设置 post-update 挂钩来将部署系统与 git 结合使用。

如果您不需要部署系统,而只想部署存储库中的部分文件,则可以使用 .gitattributes 文件和 git-archive 命令post-update 钩子。

You can use a deployment system with git by setting up a post-update hook on the production server's repository.

If you don't need a deployment system, but only want some of the files in the repo deployed, you can use a .gitattributes file and the git-archive command in the post-update hook.

少钕鈤記 2024-09-07 18:24:01

如果 Git 是您想要的路线,请尝试使用两个独立的代码分支(测试生产)。在测试上完成所有工作,确保其正常运行,然后将其合并到生产中。将您的服务器设置为从 生产 分支读取文件,您就可以开始工作了。

不过,我同意 @Almad 的观点 - 如果您正在寻找更强大的部署解决方案,那么 VCS 不是最佳选择(因为部署有点违背 VCS 的目的)。

If Git is the route you want to go, try having two separate branches of the code (test and production). Do all your work on test, make sure it functions properly, then merge it into production. Set your server to read files from the production branch and you should be in business.

I agree with @Almad, though - if you're looking for a more robust deployment solution, a VCS is not the way to go (since deployment kind of cuts against the VCS' purpose).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文