can't clone git repos via http; info/refs not

2020-05-22 07:40发布

I am trying to make a git repository available for read-only access over http.

I am doing it the old-style way because git-http-backend is not available on my host system. That is, I am simply putting the bare repository in a http accessible location.

I created the bare repository successfully on the host using git clone --bare <some-remote-location>.

Now, when I point git to the new clone using git clone http://my.host.name/location, a message reports repository not found.

When I capture network traffic, I see that git is attempting to access http://my.host.name/location/info/refs. This would be expected to fail because there is no info/refs path in the repository. Rather there are info and refs directories directly beneath the repository root.

Evidently the cloned bare repository is not structured as expected by the client. Does anyone know why this might be?

5条回答
欢心
2楼-- · 2020-05-22 07:52

I had the same error trying to clone a gitlab project because I set a wrong path !
I took the SSH path instead of the HTTP path. (+ do not forget the .git)

git clone *HTTP_path.git*
查看更多
孤傲高冷的网名
3楼-- · 2020-05-22 08:04

Try the steps mentioned here on git-scm for http/s protocol.

Basically, after doing the git clone --bare <path-to-repository>, you need to run mv hooks/post-update.sample hooks/post-update withing your bare repository and then do a git update-server-info once and then you should be able to clone the repo.

查看更多
成全新的幸福
4楼-- · 2020-05-22 08:07

I have had this issue when the remote is running on a git repository 1.7.X and the git client is 1.8.X ; I proved it by downgrading my client to 1.7.X - this fixed the issue. So make sure git is the same version on "client" and "server" sides. The command I was running was git clone .

查看更多
小情绪 Triste *
5楼-- · 2020-05-22 08:10

Remember also to check that the required modules are enable on apache. These are the required modules for git over HTTP:

  • mod_alias
  • mod_cgi
  • mod_env
查看更多
做自己的国王
6楼-- · 2020-05-22 08:16

You will need to run git update-server-info on the server to generate the files necessary for the “dumb protocol” to work.

查看更多
登录 后发表回答