将 Apache htdocs/子文件夹设置为 GIT 工作目录
我刚刚开始尝试学习 Git,但遇到了一些困难。我们正在使用 Github 来保存我们的“稳定”项目,但我在使用存储库时遇到了问题。
我想知道是否可以使用本地网络服务器 htdocs/[projectname]
作为工作目录 - 这样我可以从 github 克隆存储库,在本地服务器上对其进行处理(所以它可以工作因为应用程序应该允许我正确测试我编写的所有内容),然后阶段 ->从那里提交。
我正在使用 MAMP 环境的 Mac 上工作。该应用程序是基于 PHP 的 CMS。我们将其保存在 Github 上的一个私人存储库上。目前 Git 似乎使用 /Users/Ben/Core-CMS
作为工作目录,但这使得测试非常困难 - 如果工作目录位于 apache htdocs 内会更好 我购买
了 Pro Git,但我很难学习 git 的概念 - 我故意避免使用 GUI,因为我希望在开始“作弊”之前正确学习 Git 的内部工作原理!
I have just started trying to learn Git and I have got a little stuck. We are using Github to hold our "stable" project but I am having trouble working with the repo.
I want to know if its possible to use a local webservers htdocs/[projectname]
as the working directory - this way I could clone the repo from github, work on it on the local server ( so it works as the application should allowing me to test everything i write properly ) and then stage -> commit from there.
I am working on a Mac using the MAMP environment. The application is a PHP based CMS. We are holding it on Github on a private repository. Currently Git seems to be using /Users/Ben/Core-CMS
as the working dir but this makes it very hard to test things out - it would be much better if the working dir was inside the apache htdocs dir
I bought Pro Git but I am having a very hard time learning the concepts of git - I have purposely avoided using the GUI's as I wish to learn the inner workings of Git properly before I start 'cheating'!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有在
htdocs
目录中写入的权限,只需将/Users/Ben/Core-CMS
移动到htdocs/Core-CMS
并通过http://localhost/Core-CMS
访问它。如果您无法在
htdocs
目录中写入,我会创建/Users/Ben/web
,将我的项目放在那里并告诉 apache 从那里提供服务。要告诉 apache 在/Users/Ben/web
中查找来为您的项目提供服务,请在 apache conf: 中查找以下行并将其替换为:
If you have the permission to write in the
htdocs
dir, just move/Users/Ben/Core-CMS
tohtdocs/Core-CMS
and access it athttp://localhost/Core-CMS
.If you cannot write in the
htdocs
dir, I'd create/Users/Ben/web
, put my projects in there and tell apache to serve from there. To tell apache to look in/Users/Ben/web
to serve your projects, look for the following line in your apache conf:and replace it with:
这应该不是问题。我一直在这样做。
切换到您的公共目录并运行:
first。
克隆 git 存储库的目录不得存在。
您只需要一个授权的 ssh 密钥即可将您的更改从存储库推送到安装在服务器上的 github 和 git(或者如果您已将所有内容安装到本地计算机上,则在您的客户端中)。
然后你提交这只是本地的,如果你完成了,你可以将你的更改推送到 github。
另一种方法是让网络服务器使用您的工作目录作为其
DocumentRoot
。我希望我没有错过你的问题;)
This should not be a problem. I'm doing this all the time.
Switch to your public directory and run:
first.
The dir where you clone a git repository must not exist.
You just need a ssh key authorized to push your changes from the repository to github and git installed on the server (or in your client if you have mounted everything to your local machine).
Then you do you commit which is just local and if you are done you may push your changes to github.
Another way would be to make the webserver use your working directory as its
DocumentRoot
.I hope I didn't miss your problem here ;)