How do you setup cgit with pull and push over http?
题
I am trying to setup a cgit instance from which you can push or pull over http. However, i am able to browse my repos over http via cgit, but when i try to push to this repo, i get an error:
Fatal, /info/refs not valid, is this a git repository?
This path exists on the server, and this is an empty file. I have created a post-update hook which executes git update-server-info automatically (the post-update.example from the repo). But when i try to view the /info/refs file via http, cgit has an announcement, that this is an empty repository.
What can i do to get access to this file via http, so i can push or pull with the urls that cgit provides to me?
I have my repos on a shared hosting provider, so i have no access to the apache.conf but only to the .htaccess files...
解决方案
As far as I can tell, cgit doesn't enable pushing to Git repositories (from looking through their feature list).
You'll likely need to setup something like git-http-backend
to be able to push. The git-http-backend
manpage has example configurations for Apache 2.x for anonymous read with authenticated write, and for authenticated read and write.
其他提示
If you would like a backend that is more feature rich than git-http-backend
, I would recommend gitolite. It has some really nice features:
- Use a single unix user ("real" user) on the server
- Provide access to many gitolite users:
- they are not "real" users
- they do not get shell access
- Control access to many git repositories:
- read access controlled at the repo level
- write access controlled at the branch/tag/file/directory level, including who can rewind, create, and delete branches/tags
- Can be installed without root access, assuming git and perl are already installed
- Authentication is most commonly done using sshd, but you can also use http if you prefer (this may require root access)
- Store all configuration in an admin git repository
This is just some of the more important features. In addition it is easy to extend its behavior with your own scripts.