From a8f013058b2dabc030e34a19a978614311f173bd Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 16 Aug 2016 10:58:07 +0300
Subject: [PATCH] - Added post about ad-hoc serving of git repos.

---
 content/git_serve.rst | 54 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 content/git_serve.rst

diff --git a/content/git_serve.rst b/content/git_serve.rst
new file mode 100644
index 0000000..303e059
--- /dev/null
+++ b/content/git_serve.rst
@@ -0,0 +1,54 @@
+Ad-hoc serving of git repositories
+##################################
+
+:date: 2016-08-16
+:summary: Ad-hoc serving of git repositories
+
+On some occasion you want to serve your git repo from your local copy (perhaps
+your git repository is quite large and your internet connection is slow or your
+build process would benefit from pulling from an intermediary without
+authentication). Here are 2 ways to serve your git repository without any
+configuration or software installation. Both ways serve a single repository
+without authentication or encryption but readonly (no push).
+
+Using the git protocol
+----------------------
+
+The git executable is itself a git server using the native git protocol. Inside
+the root of the repository run the following command
+
+.. code:: shell
+
+    git daemon --reuseaddr --verbose  --base-path=. --export-all ./.git
+
+And on the client you can clone by running
+
+.. code:: shell
+
+    git clone git://servername/ reponame
+
+
+Using the http protocol
+-----------------------
+
+This way serves the repo over HTTP using Python 2's SimpleHTTPServer. Run the
+following in the rot of the git repo
+
+.. code:: shell
+
+    git update-server-info
+    cd .git
+    python -m SimpleHTTPServer
+
+And on the client clone by running
+
+.. code:: shell
+
+    git clone http://servername:8000/ reponame
+
+
+Final words
+-----------
+
+I've added both ways as git aliases in my `rcfiles repo
+<https://www.shore.co.il/cgit/rcfiles/tree/.gitconfig>`_.
-- 
GitLab