How track the process of repository cloning on GIT server? I need information about who and when have cloned the repository. Furthermore where can I find the information about how much new repository were made and who did they on the server? It needs for making statistic.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
As mentioned in this SO question:
Cloning is a read-only operation, the original repository isn't modified. There is no way you can pull statistics for data that simply isn't tracked.
This isn't entirely true, however, depending on the Git repo server.
If you want to keep track of git operations (including cloning) only for one specific "central" repo server, then you can add an "authorization layer" like Gitolite which will intercept any git command, check if you are authorized to do said command, and execute it.
This is where you can, just after the execution, to add your own tracking system.
On that same server, you can also extend a front-end like gitlib to include those stats (clones) in the repo stats screen:
However:
- Those extensions (with gitolite and gitlib) which would intercept the
git clone
command (with gitolite) and display associated stats (gitlib) are not yet implemented.
They shouldn't be complex to code, though. - this doesn't (and will not) take into account all the other
git clone
done for that same repo on other Git workstation. Ie, once cloned from your main "central" Git repo server, that same repo can be cloned again many time from workstation to workstation. You won't know it.