PHP 和 Netbeans - 使用 sftp 或 svn 获取远程源
给你们两个场景:
1:
我使用带有内置 sftp 的 Netbeans。我将把远程源的副本复制到我的计算机上,然后对其进行编辑。 Netbeans 将使我的本地副本和远程源保持同步。
2:
我用的是svn。检查远程源。在 netbeans 中打开本地项目。当我想查看我的更改时,我必须首先提交,然后使用服务器上的 ssh 进行更新,然后打开浏览器并查看更改。乏味。
我想要第一个场景。这不是生产环境。目前我是唯一一个从事这个项目的人。但有一天,我得到一位同事的帮助,只是做一个 QA 或为我修复一个简单的错误,如果我想工作,那么直接 sftp 到开发环境并不酷,因为他正在帮助我或其他什么......
有人遇到过同样的情况吗?我确信还有其他我还没有发现的方法;)
Two scenarios for you guys:
1:
I use Netbeans with the built in sftp. I will get a copy of the remote source to my computer, and edit that. Netbeans will keep my local copy and the remote source in sync.
2:
I use svn. Checkout the remote source. Open a local project in netbeans. When I want to see my changes, I have to first commit, then with ssh from the server do update, and then open my browser and see the changes. Tedious.
I want to go for the first scenario. It's not the production-environment. And currently I'm the only one working on this project. But one day I get a colleague helping me out, just doing a QA or fixing one simple bug for me and sftp directly to the development-environment is not cool if I want to work as he is helping me out or whatever...
Anyone been in the same situation? I'm sure there's some other way that I haven't discovered yet ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我结合使用了两种方案,SFTP 来更新服务器上的远程源,SVN 来跟踪更改和历史记录,这样如果我搞砸了某些事情,我可以回滚。 NetBeans 支持两者,当您通过向导创建 PHP 项目时,您将进入第三页,显示项目创建页面的运行配置选择远程网站(FTP、SFTP),然后它将允许您将设置更改为与您的服务器的文件匹配,您可以将“运行时上传文件”更改为“保存时上传文件”,这样每当您保存文件时,它就会自动上传到服务器。
对于 SVN,创建项目后只需右键单击项目名称并从菜单中选择“团队”,然后导入到 SVN 将项目导入到 SVN 存储库中,如果它已经在 SVN 存储库中,您可以使用“团队”菜单顶部菜单栏并选择签出从源创建项目并自动将其置于 SVN 控制下,然后您只需右键单击项目名称并更改运行配置即可将项目设置为在保存时上传到远程服务器/跑步等等....
希望有帮助。
I use a combination of the two scenarios, SFTP to update the remote source on the server and SVN to just keep track of changes and history so that if I mess something up I can roll back. NetBeans supports both, when you create a PHP project through the wizard you'll get to the 3rd page that says Run Configuration of the Project creation page select Remote Web Site (FTP, SFTP), it will then allow you to change your settings to match those of your server and you can change Upload Files from on Run to on Save so that whenever you save a file it is automatically uploaded to the server.
For SVN after your project is created just right click on the project name and select "Team" from the menu and then import into SVN import the project into a SVN repo, if it's already in a SVN repo you can use the Team menu from the menu bar up top and select check out to create a project from the source and have it automatically under SVN control, then you can just right click on the project name and change the Run Configuration to set the project to upload to the remote server on Save/Run etc....
Hope that helps.
首先,您 必须使用版本控制系统。所以我认为你无论如何都会使用SVN。
恕我直言,你能做的最好的事情就是向 SVN 添加一个钩子,说明 当您提交时,更新测试服务器。现在,要查看测试服务器上的更改,您只需提交您的工作即可。
但是,我不建议在生产服务器上执行此操作,因为最好在部署之前检查您的内容是否正常工作。此外,它还会产生一种不常犯错误的倾向,这是非常糟糕的。
First, you have to use a versionning system. So I think you are going to use SVN anyway.
The best thing you can do, imho, is to add a hook to SVN saying that when you commit, update the test server. Now, to see changes on the test server, you just have to commit your work.
However, I woudn't recommend to do that on a production server, because is it better to check that your stuff is working before deploying it. Also, it creates a tendency to commit les often, which is bery bad.