git equivalent of 'hg serve'?
For just browsing files and revisions git instaweb
is the right solution.
In addition if you want to set-up an ad-hoc git server for sharing work (push/pull) with some colleagues (which hg serve
also allows you to do), you can use:
git daemon --reuseaddr --base-path=. --export-all --verbose --enable=receive-pack
Your colleagues will use it with something like:
git clone git://<ip-address>/.git project
Addition 1:
If you want to be able to push to this server, you need to add the --enable=receive-pack
option (Thanks to Dominik below).
Addition 2:
It just happened to me so I add it to the answer :-), if you are using a Redhat-based Linux distribution (RHEL, CentOS, etc.) and have an error "git: 'daemon' is not a git command."
, then you need to install a seperate package for it:
sudo yum install git-daemon
I think what you're looking for is git instaweb
.
By default it uses lighttpd
, but any other web server like webrick
also should work.
I prefer webrick because it is much convenient (and I have ruby
and webrick
gem installed)
Examples:
# 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
You should be able to configure the instaweb
settings in your .git/config
or ~/.gitconfig
and merely run git instaweb --start
and git instaweb --stop
to control instaweb:
[instaweb]
local = true
httpd = webrick
port = 1234
browser = chromium
UPDATE:
git-webui which alberthier mentioned in his answer, is actually a much richer UI compared to the default instaweb
and installation is also really straight-forward.