0

kestrel http server (win7 sp1 x64) running on port 3112 and serve static git repository files

these commands are executed using git bash on win10 and win7 client machines with same results

curl http://server:3112/repository/.git/HEAD
// ok

git ls-remote file://server/shared-folder/repository 
// ok

git ls-remote http://server:3112/repository/.git
// fatal: repository 'http://server:3112/repository/.git/' not found

how to fix this issue?

geek175
  • 127
  • 1
  • 7

1 Answers1

2

When you're exposing a repository over HTTP or HTTPS, there are two ways you can do so: the legacy protocol, which uses WebDAV, and the smart protocol. In both situations, Git needs more than just the HEAD reference: it also needs some data under the path info/refs which tells it (a) which protocol it's using and (b) information about what references are available. It also needs a way with the legacy protocol to determine what objects and packs exist. This is because HTTP doesn't provide standardized directory and file listings, and as a consequence Git has to have this information generated.

Git by default ships with a post-update hook which calls the git-update-server-info program, which generates the necessary files by default. You'll need to run this before it can be accessed over HTTP and also any time the repository changes.

Note that even if you do this, without further configuration this repository will be read only. You can read more about how to configure a read-write server with the smart protocol and CGI using git http-backend --help.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • running `git update-server-info` manually on the repository resolved the issue. the repository is updated by `git fetch` followed by `git reset --hard FETCH_HEAD`, what hook should I use to automatically call `git update-server-info` after updating the repository? – geek175 Aug 29 '22 at 08:09
  • 1
    The `post-update` hook is only called when you push into the repo. If you're not pushing into it, then you need to call `git-update-server-info` every time you update the repo in any way. Also, typically it's not a good idea to serve non-bare repos over HTTP. – bk2204 Aug 29 '22 at 21:28