Is there a Git Server Side Hook to put quota on repository sizes? -
i searched around , found related topics, related limiting file sizes or concerns there quotas.
i built git server gitolite place students share course projects. functions under 1 username on server, git, wild card repositories "projects/creator/[a-za-z0-9].*". repositories have writers , readers defined user can modify can write , read repository.
ssh key files implemented user can create repository by:
git clone git@servername.edu:projects/bob/project1 git clone git@xervername.edu:projects/bob/someotherproj
and on. "bob" folder created first time git clone (it's username).
my issue that, being students, there abuse , need limit size of "bob" folder. disk quotas don't work because folders , files owned git, , that's limited.
i can re-engineer serve projects linux home folders , able use disk quotas, however, i'd rather not have re-engineer server have working.
essentially, looking hook did rough shell script:
foldersize=`du -s $gitpath/projects/$username` if [ $foldersize > 250000 ]; echo "quota exceeded" exit 1 fi
i understand there server side hooks can written, wanted see if wheel created before started carving out. so, hooks limit repository size?
the git pre-receive
hook used implement quotas. githooks(5)
man page:
this hook invoked git-receive-pack on remote repository, happens when git push done on local repository. before starting update refs on remote repository, pre-receive hook invoked. exit status determines success or failure of update.
so put quota checking logic in script , allow or reject incoming update depending on result. job perform quota management; there number of ways this, simplest being relying on filesystem's support user quotas.
you use du
example, although repositories grow in size impose substantial delay (and i/o burden) each update. caching results script amount of time out, although trade-off here exceed quota if push update before cache has expired.
depending on how storage organized, per-directory quotas git repositories (if storage comes supports this, enterprise fileservers), or using lvm volume per repository (as suggested here).
despite suggestions contrary, implementing quotas remote repository common. git-hosting services limit disk storage , reject updates once hit limit.
Comments
Post a Comment