Title: How to publish a git repository on http | |
Author: Solène | |
Date: 07 October 2016 | |
Tags: unix git versioning | |
Description: | |
Here is an how-to in order to make a git repository available for | |
cloning through a simple http server. This method only allow people to | |
fetch the repository, not to push. I wanted to set-up this to get my | |
code, I don't plan to have any commit on it from other people at this | |
time so it's enough. | |
In a folder publicly available from your http server clone your | |
repository in bare mode. As explained in | |
the | |
[https://git-scm.com/book/tr/v2/Git-on-the-Server-The-Protocols](man | |
page): | |
$ cd /var/www/htdocs/some-path/ | |
$ git clone --bare /path/to/git_project gitproject.git | |
$ cd gitproject.git | |
$ git update-server-info | |
$ mv hooks/post-update.sample hooks/post-update | |
$ chmod o+x hooks/post-update | |
Then you will be able to clone the repository with | |
$ git clone https://your-hostname/some-path/gitproject.git | |
the clone wasn't possible. |