I want to know how to simply publish over http = much like Mercurial's hg serve! On the Windows/work box do this:
git serve
and then on the Linux box SIMPLY go:
git clone http://project project
finished.
I want to know how to simply publish over http = much like Mercurial's hg serve! On the Windows/work box do this:
git serve
and then on the Linux box SIMPLY go:
git clone http://project project
finished.
Navigate into your project and start git-daemon with the following switches:
cd project
git daemon --reuseaddr --base-path=. --export-all --verbose
This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .git/ folder). It also tells it to re-use the same address if you shut it down and start it back up too fast.
You can put this into a batch script with an easy to remember name like "gitserve", so you don't need to type it all out again. As suggested in some of the comments, in recent versions of Git you can add an alias to the Git config:
[alias]
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
Once that's done on the server (your Windows box), you can do:
git serve
git-daemon uses the git:// protocol for transport, so on the client (your Linux box), you would need to do:
git clone git://123.456.789.111/ project
git daemon
allows for remote access by other git clients, it lacks the Web interface that hg serve
provides. –
Pilgarlic git: 'daemon' is not a git-command
you need to upgrade your git installation. –
Deutschland serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
–
Seasickness --enable=receive-pack
parameter if you wish to enable pushes. [Source] I've documented this a bit on this gist –
Jungjungfrau Rather than write your own batch script, use gitjour. It knows how to start git daemon correctly and will broadcast the clone URL via mDNS so you can do gitjour show
on the linux box and copy and paste.
Also a good article with an overview of gitjour and a number of other similar tools from Dr. Nic, What is *jour and why they are killer apps for RailsCamp08.
If you just want to expose the repository with a web browser
$ git instaweb -d apache2 --start
$ lynx localhost:1234
lighttpd not found. Install lighttpd or use --httpd to specify another httpd daemon.
–
Klee git instaweb -d webrick
on OS X, because webrick comes with Ruby, which is preinstalled on OS X. –
Ineligible Currently using two aliases - serve and hub. Serve for read-only share and hub for read/write share:
[alias]
serve = !git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose
hub = !git daemon --base-path=. --export-all --enable=receive-pack --reuseaddr --informative-errors --verbose
Also, there is more detailed tutorial about sharing via git daemon: http://l.rw.rw/git-daemon .
Here is an alternative way. You will need python installed.
git update-server-info
.git
directorypython -mSimpleHTTPServer
(just create an alias in your gitconfig)
Now you can pull the repo with git pull http://HOST_NAME:8000/
PS: when usingthe git daemon solution you can set --base-path=.git
so the url is git://HOST/
Git 2.21 (Feb. 2019) allows you to combine python and git instaweb
:
See commit 2eb14bb (28 Jan 2019) by Arti Zirk (artizirk
).
(Merged by Junio C Hamano -- gitster
-- in commit abf39e3, 05 Feb 2019)
git-instaweb
: add Python builtinhttp.server
supportWith this patch it is possible to launch
git-instaweb
by using Pythonhttp.server
CGI handler via-d python
option.
git-instaweb
generates a small wrapper around thehttp.server
(inGIT_DIR/gitweb/
) that address a limitation of the CGI handler where CGI scripts have to be in acgi-bin
subdirectory and directory index can't be easily changed. To keep the implementation small,gitweb
is running on url/cgi-bin/gitweb.cgi
and an automatic redirection is done when opening/
.The generated wrapper is compatible with both Python 2 and 3.
Python is by default installed on most modern Linux distributions which enables running
git instaweb -d python
without needing anything else.
git-webui is a git extension which provides a web based user interface and the ability to clone/pull from other computers
https://github.com/alberthier/git-webui
$ cd my_git_repo
$ git webui
Other people can
$ git clone http://<ip-of-your-computer>:8000/ repoclone
or
$ git pull http://<ip-of-your-computer>:8000/
Add following lines in .git/config
[instaweb]
local = true
httpd = webrick
port = 4231
then execute
git instaweb
© 2022 - 2024 — McMap. All rights reserved.
git instaweb -d python
could be nough (with Git 2.21, Feb. 2019): see my answer below – Bran