你可以使用钩子来完成这个任务。 在stackoverflow上已经讨论过了。https://stackoverflow.com/questions/7147699/limiting-file-size-in-git-repository