开发者

What does git update-server-info do?

开发者 https://www.devze.com 2022-12-16 14:01 出处:网络
What does git update-server-info do?How do I know if I need it? The manual says: 开发者_运维技巧A dumb server that does not do on-the-fly pack generations must have some auxiliary information files

What does git update-server-info do? How do I know if I need it? The manual says:

开发者_运维技巧A dumb server that does not do on-the-fly pack generations must have some auxiliary information files in $GIT_DIR/info and $GIT_OBJECT_DIRECTORY/info directories to help clients discover what references and packs the server has. This command generates such auxiliary files.

How do I know if my server is dumb, and whether it does or does not do "on-the-fly pack generations", and whether it "must have some auxiliary information files"?

I am pushing a web app via ssh to a bare repository, then pulling from that bare repository into the web root.


Dumb server basically means accessed over HTTP. So if you access your Git repository over http: or https: URLs, you need the update-server-info business, otherwise (git:, ssh:, etc.) you don't need it.


But do you have to execute git update-server-info after every push to the repo?

A git repack can also use git update-server-info, updating the local catalog files needed to publish this repository (or a direct copy of it) over HTTP or FTP.

With Git 2.36 (Q2 2022), "git repack"(man) learned a new configuration to disable triggering of age-old update-server-info command, which is rarely useful these days (2022).

See commit a2565c4, commit 64a6151 (14 Mar 2022) by Patrick Steinhardt (pks-t).
(Merged by Junio C Hamano -- gitster -- in commit bfce3e7, 23 Mar 2022)

repack: add config to skip updating server info

Signed-off-by: Patrick Steinhardt

By default, git-repack will update server info that is required by the dumb HTTP transport.
This can be skipped by passing the -n flag, but what we're noticably missing is a config option to permanently disable updating this information.

Add a new option "repack.updateServerInfo" which can be used to disable the logic.
Most hosting providers have turned off the dumb HTTP protocol anyway, and on the client-side it wouldn't typically be useful either.
Giving a persistent way to disable this feature thus makes quite some sense to avoid wasting compute cycles and storage.

git config now includes in its man page:

repack.updateServerInfo

If set to false, git repack will not run git update-server-info.

Defaults to true. Can be overridden when true by the -n option of git repack.

0

精彩评论

暂无评论...
验证码 换一张
取 消