I want to know whether or not some one run a 'git fetch' command on my repo. Could i check the git operations' history by some commands? Thanks.
1 Answers
It depends where is located the repository accessed by "someone" for their git fetch
.
If it is on-premise (your own machine, or servers you control/have access to), then you can at least modify the listeners (SSH or HTTPS) in order to record the IP address of that "someone" when the fetch query comes in.
A Git listener wrapper (both for SSH or HTTPS) like gitolite has a dedicated audit log
folder.
But if it is in a server / repository hosting service, you might not have access to detailed audits, if at all:
- GitLab does have then, but only for Enterprise Edition (not free)
- GitHub have them for GitHub Organization (possibly accessible for free), but not for fetch events.
A remote service API could give access to repository events, but those event types more likely include push (to measure contribution), more rarely pull/fetch.
As I mentioned here, you have ways to get the number of clones/download for a given repository, but not "who" exactly did clone/fetch a repository (again for remote Git repository hosting services like GitHub or GitLab).
Hence the importance to know more about the nature of the server where the Git repository is fetched from.
-
Thanks for your help!!Your answer is quite comprehensive and clear!!Thank you!! – jia qiao May 18 '20 at 06:58
-