如何使 Hg/Git 成为远程仓库?
我是 DVCS 的初学者(我来自 SVN 世界),现在我掌握了自己的本地存储库,我想设置一台远程计算机 (Amazon EC2) 来保存我的 Web 文件 一些东西
这样我就可以轻松更新网络应用程序,而无需 FTP 或我最终想要使用的
hg push http://hg.domain.com/webserver/hello
:或 git
git push myAmazon master
我必须在远程服务器中配置什么(安装 Hg/Git) 使用将文件夹设为存储库init
接下来应该做什么?
也许我对上面的答案并不是100%清楚,所以这里有一个简单的问题
我想使用 Git / Hg
push
替换 FTP Upload,我该如何实现?
因此,让我们想象一下这种情况:
C:\Inetpub\wwwroot\mybrandNewWebApp
是 IIS 中托管的站点的根(这是一台远程计算机,例如:在 Amazon EC2 中) ),在这个目录中,我使用 git init / hg init 启动了一个存储库。
如何配置此存储库,以便我可以从自己的笔记本电脑进行远程推送
以“上传我的更改”?
如何配置此存储库使其可访问和可推送?
阅读所有评论的问题?
我是否应该创建其他目录作为存储库,并在良好的推送后使用我可以运行一个实际更新网站根目录的脚本?
I'm a beginner in DVCS (I'm from SVN world) and now that I mastered my own local repo, I would like to set up a remote computer (Amazon EC2) to hold my Web files so I can easily update the web application without FTP or some sorta things
I would like to end up using:
hg push http://hg.domain.com/webserver/hello
or git
git push myAmazon master
What do I have to configure in my remote server (installing Hg/Git) make a folder a repo using init
and what should be next?
Maybe I wasn't 100% clear with the answer above, so here is a simple question
I want to replace FTP Upload by using Git / Hg
push
, how can I accomplish this?
So, let's imagine this scenario:
C:\Inetpub\wwwroot\mybrandNewWebApp
is the root of a Site hosted in IIS (this is a remote computer, example: in Amazon EC2), at this directory I started up a repository using git init
/ hg init
.
How can I configure this repository that from my own laptop I can do a push remote
to "Uploading my changes"?
How can I configure this repository to be Reachable and Pushable?
Question from reading all comments?
Should I create other directory to be the repo and using upon a good push I could run a script that would actually update the website root directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 Mercurial,您需要设置 Mercurial 附带的
hgweb
Web 服务器(至少在源版本中)。步骤如下(顺序可能不正确):
网上有很多教程,但没有一个是 100% 完整的,因为如果您一步一步地遵循它们,那么一切都会工作,但需要进行少量的修改它会起作用的。
这里有几个:
编辑:我的答案告诉您如何设置可以推送到的 Mercurial Web 服务器。由于您的目标是通过推送更改来更新 Web 服务器,因此还有其他选择:
我有相同类型的设置,但我所做的如下:
hg pull -u
命令克隆,然后使用 ROBOCOPY 将所有内容(除了一些调试文件和 .hg 目录)镜像到主网站文件夹中这意味着:
For Mercurial you'll need to set up
hgweb
the web server that Mercurial comes with, at least in the source-version.The steps are (possibly incorrect order):
There are numerous tutorials on the web, none of them 100% complete in the sense that if you follow them step by step it'll all work, but with a small amount of tinkering it will work.
Here's a couple:
Edit: My answer tells you how to set up a Mercurial web server that you can push to. Since your goal is to update the web server by pushing out your changes, there are other options:
I have the same type of setup, but what I have done is the following:
hg pull -u
command in a local clone, and then a ROBOCOPY to mirror everything (except some debug files, and the .hg directory) into the main web site folderThis means that:
如果您在服务器上运行 ssh,则可以使用 Mercurial 和 git 及其 ssh 协议。
您甚至可以通过这种方式在服务器上创建存储库:
If your run ssh on the server, you can use mercurial and git with their ssh-protocols.
You can even create repositories on the server that way:
您可以使用 Mercurial 和 Git 来达到此目的。如果您从计算机推送某些内容,该工具会将新数据复制到远程服务器。
问题是数据只是位于远程存储库中,但您希望它位于 Web 服务器可以看到它的位置,也就是说您错过了“更新”步骤(将数据从存储库复制到 Web 服务器的文件系统中) )。
更清楚地说:
commit
将数据从本地文件系统移动到本地存储库。push
在存储库之间移动数据(忽略文件系统中的内容)update
/pull
更新文件系统。您必须在您的网络服务器上执行此操作。我的建议是编写一个小脚本,每小时左右运行一次
hg update
或git pull
。在 Windows 中将该脚本安装为任务。You can use both Mercurial and Git for the purpose. If you push something from your computer, the tool will copy the new data to the remote server.
The problem is that the data just sits in the remote repository but you want it in a place where the Web server can see it, that is you're missing the "update" step (copy the data from repository into the Web server's file system).
To make it more clear:
commit
moves the data from your local file system into your local repository.push
moves data between repositories (ignoring what's in the file system)update
/pull
updates the file system. You have to do this on your web server.My suggestion is to write a small script that runs
hg update
orgit pull
every hour or so. Install that script as a task in windows.