问题
I work at the team which works with git repository. We have an origin and several local copies. Everybody interacts with origin by different means: from Unix, from Windows, Unix shell, Windows shell, NetBeans, PHPStorm. It happens that somebody deleted several local and remote branches. We already restored them.
But how to find the person who is responsible for it?
I checked git reflog
, but can't see anything suspicious there.
回答1:
Git doesn't keep an audit trail of the operations done to a repo.
Plus it doesn't have any authentication mechanism, so it doesn't know who did what.
To keep track of that (who did what), you need to add to your central a repo an authorization layer like gitolite.
That assumes you communicate with your central repo through an authentication mechanism like:
- Apache
- SSH
(using a shared path or git url wouldn't include the authentication id that gitolite needs to validate/authorize the git command)
The idea is that, since gitolite validate every git commands based on who you are, it is in a unique position to keep the kind of audit trail (who did what) you are after.
来源:https://stackoverflow.com/questions/18010392/how-to-find-out-who-delete-a-branch-at-git