相当于'hg serve'的git?

时间:2013-03-27 22:24:01

标签: git mercurial

是否有某种插件可用于拥有与Mercurial相当的git

hg serve

('hg serve'启动本地Web服务器,允许您浏览存储库历史/分支等)

3 个答案:

答案 0 :(得分:62)

仅浏览文件和修订版git instaweb是正确的解决方案。

此外,如果你想设置一个 ad-hoc git服务器,用于与一些同事共享工作(推/拉)(hg serve允许你这样做),你可以使用:

git daemon --reuseaddr --base-path=. --export-all --verbose --enable=receive-pack

您的同事会使用以下内容:

git clone git://<ip-address>/.git project

增加1:

如果您希望推送到此服务器,则需要添加--enable=receive-pack选项(感谢下面的Dominik)。

增加2:

它恰好发生在我身上,所以我将它添加到答案:-),如果您使用的是基于Redhat的 Linux发行版(RHEL,CentOS等)并且出现错误{{ 1}},然后你需要为它安装一个单独的包:

"git: 'daemon' is not a git command."

答案 1 :(得分:22)

我认为你要找的是git instaweb

默认情况下,它使用lighttpd,但webrick等任何其他网络服务器也应该有效。

我更喜欢webrick,因为它非常方便(我安装了rubywebrick gem)

示例:

# Starts a web server on port 1234 and opens up a web browser
git instaweb --httpd=webrick

# To stop webrick
git instaweb --httpd=webrick --stop

您应该可以在instaweb.git/config中配置~/.gitconfig设置,只需运行git instaweb --startgit instaweb --stop来控制instaweb:

[instaweb]
    local = true
    httpd = webrick
    port = 1234
    browser = chromium

更新:

git-webui alberthier在他的回答中提到,与默认instaweb相比,实际上是一个更丰富的用户界面,安装也非常直接。

答案 2 :(得分:8)

git-webui是一个git扩展,它提供基于Web的用户界面以及从其他计算机克隆/拉取的能力

https://github.com/alberthier/git-webui

$ cd my_git_repo
$ git webui

其他人可以

$ git clone http://<ip-of-your-computer>:8000/ repoclone

$ git pull http://<ip-of-your-computer>:8000/
相关问题