Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advocate git config receive.updateServerInfo instead of enabling a post-update hook #1829

Open
datamuc opened this issue Feb 11, 2023 · 0 comments

Comments

@datamuc
Copy link

datamuc commented Feb 11, 2023

===== Dumb HTTP
(((protocols, dumb HTTP)))
If the server does not respond with a Git HTTP smart service, the Git client will try to fall back to the simpler _Dumb_ HTTP protocol.
The Dumb protocol expects the bare Git repository to be served like normal files from the web server.
The beauty of Dumb HTTP is the simplicity of setting it up.
Basically, all you have to do is put a bare Git repository under your HTTP document root and set up a specific `post-update` hook, and you're done (See <<ch08-customizing-git#_git_hooks>>).
At that point, anyone who can access the web server under which you put the repository can also clone your repository.
To allow read access to your repository over HTTP, do something like this:
[source,console]
----
$ cd /var/www/htdocs/
$ git clone --bare /path/to/git_project gitproject.git
$ cd gitproject.git
$ mv hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update
----
That's all.(((hooks, post-update)))
The `post-update` hook that comes with Git by default runs the appropriate command (`git update-server-info`) to make HTTP fetching and cloning work properly.
This command is run when you push to this repository (over SSH perhaps); then, other people can clone via something like:

I think instead of installing that hook the code block should look like this:

$ cd /var/www/htdocs/
$ git clone --bare /path/to/git_project gitproject.git
$ cd gitproject.git
$ git config receive.updateServerInfo true

The advantage is, that one can also set this option globally with git config --global or even --system, which is nice because it not necessary anymore to handle that hook for each repo individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@datamuc and others