Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: simplest way to share a repository between two laptops on a local network?

Tags:

git

If my friend has a git repository on his laptop, and we are both connect to the same LAN, what's the absolute simplest way for me to clone that repository?

As far as I can tell, the options are:

  • Getting SSH access to his machine
  • Installing a web server and using git instaweb

But neither of these are particularly simple (or, at least, as simple as hg serve)… Is there anything better?

like image 668
David Wolever Avatar asked Jun 15 '11 19:06

David Wolever


4 Answers

cd project
git daemon --reuseaddr --base-path=.git --export-all --verbose

To access: git pull git://HOST/

See answer https://stackoverflow.com/a/377293/794407

like image 50
bara Avatar answered Sep 22 '22 21:09

bara


I don't remember what all the options mean, so it may take some playing, but I think git daemon does what you want. I have had it work in the past.

like image 40
psycotica0 Avatar answered Sep 25 '22 21:09

psycotica0


For cloning only, you want to use git daemon --export-all $PWD You can configure it to be read/write, but that is very insecure.

git-instaweb does not allow you to clone a repository.

Of course using github is a convenient way to share repositories without lots of configuration (though setting up an ssh server is usually not very difficult).

like image 20
Seth Robertson Avatar answered Sep 22 '22 21:09

Seth Robertson


Not exactly point-and-click, but this might help:

http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

Also, if you have access to his drive via any type of share (NFS, Samba, etc) then you can clone via the share name.

Oh, and there's also git-daemon.

like image 32
Alex Howansky Avatar answered Sep 25 '22 21:09

Alex Howansky