Distributed Version Control System: Git has a remote repository which is stored in a server and a local repository which is stored in the computer of each developer. This means that the code is not just stored in a central server, but the full copy of the code is present in all the developers' computers.
Own Git server As described before, you do not need a server. You can just use a file system or a public Git provider, such as GitHub or Bitbucket. Sometimes, however, it is convenient to have your own server, and installing it under Ubuntu is relatively easy. First make sure you have installed the SSH tooling.
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
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.
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 .
If you just want to expose the repository with a web browser
git-instaweb
$ git instaweb -d apache2 --start
$ lynx localhost:1234
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With