有没有git活动日志? [英] Is there a git activity log?

查看:151
本文介绍了有没有git活动日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有些事情真的不对。请允许我提供背景信息。



今天我尝试推送到我们公司的默认裸msysgit windows服务器并获取可怕的错误消息在SO中无处不在,关于推送到非裸站。我认为这个消息很奇怪,因为我的服务器应该是裸露的。然后,我发现了 core.bare 以某种方式设置为 false !这是一个使用 - bare 进行的回购,并且它从未有过 .git 文件夹。然后我去检查一下,那里是一个.git文件夹,对我来说是无处不在的,让我沮丧!我问唯一可以在那里做点什么的人,当然,他没有。



edit :我刚注意到它只发生在 master 分支和服务器的 .git 似乎是在10月1日创建的,这可能是正确的我经常不会推送到 master



该文件夹有3gb和裸文件夹,全部使用git除了幽灵般的 .git 之外的结构,有6GB。虽然我的本地.git有16 GB,所以我不确定那里发生了什么......更重要的是,我无法检查 git log git reflog 。无论是设置裸露为true或false我得到相同的错误 致命:错误的缺省修订'HEAD' 。现在我认为已经到了考虑如何恢复回购的时候了......



但在我修复所有修复教条之前,我想知道:


  • 类型的 git活动日志 ,所以我可以看到在git中发布的所有命令以及由谁发布的命令?



找不到类似的东西,我恐怕没有。

解决方案

这就是为什么我们已经安装了 gitolite V3 (只需克隆它的repo 安装它这个安装脚本)上我们的中央gi t回购服务器。



Gitolite将拦截任何git命令,并且(除了主要授权框架功能)将在〜/ .gitolite / logs / gitolite-log-xxx 中记录所述命令。



以下是这些日志的摘录:

  2012-08 -16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-git-configs,POST_COMPILE 
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-gitweb-access-list,POST_COMPILE
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / commands / access, %,gitweb,R,任何
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / commands / git-config,-r,%,gitweb\。
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-git-daemon-access-list,POST_COMPILE
2012-08- 16.12:20:20 29507系统,/ home / gitadmin / gitolite / bin / commands / access,%,守护进程,R,任何
2012-08-16.12:20:20 29507 END
2012-08 -20.07:39:12 17683 ssh ARGV = gitoliteadm SOC = git-upload-pack'gitolite-admin'FROM = 127.0.0.1
2012-08-20.07:39:12 17683 access(gitolite-admin,gitoliteadm, R,'任何'), - > refs /.*
2012-08-20.07:39:12 17683 trigger,Writable,access_1,ACCESS_1,gitolite-admin,gitoliteadm,R,any,refs /.*
2012-08-20.07: 39:12 17683 pre_git gitolite-admin gitoliteadm R any - > refs /.*
2012-08-20.07:39:12 17683 system,git,shell,-c,git-upload-pack'/home/gitadmin/repositories/gitolite-admin.git'
2012-08-20.07:39:12 17683 END
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-git-configs,POST_COMPILE
2012-08-16.12:20:19 29507系统,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-gitweb-access-list,POST_COMPILE
2012-08-16.12:20 :19 29507 system,/ home / gitadmin / gitolite / bin / commands / access,%,gitweb,R,any
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin /命令/ GIT-配置,-R,%,gitweb\。
2012-08-16.12:20:19 29507 system,/ home / gitadmin / gitolite / bin / triggers / post-compile / update-git-daemon-access-list,POST_COMPILE
2012-08- 16.12:20:20 29507系统,/ home / gitadmin / gitolite / bin / commands / access,%,守护进程,R,任何
2012-08-16.12:20:20 29507 END
2012-08 -20.07:39:12 17683 ssh ARGV = gitoliteadm SOC = git-upload-pack'gitolite-admin'FROM = 127.0.0.1
2012-08-20.07:39:12 17683 access(gitolite-admin,gitoliteadm, R,'任何'), - > refs /.*
2012-08-20.07:39:12 17683 trigger,Writable,access_1,ACCESS_1,gitolite-admin,gitoliteadm,R,any,refs /.*
2012-08-20.07: 39:12 17683 pre_git gitolite-admin gitoliteadm R any - > refs /.*
2012-08-20.07:39:12 17683 system,git,shell,-c,git-upload-pack'/home/gitadmin/repositories/gitolite-admin.git'
2012-08-20.07:39:12 17683 END


Something went really wrong here. Allow me to give the background.

Today I try to push to our company default bare msysgit windows server and get a dreaded error message duplicated everywhere in SO about pushing to non-bare. I thought the message was weird, since my server was supposed to be bare. And yesterday it was working just fine.

Then I noticed the core.bare is, somehow, set to false! This was a repo inited with --bare and it never had a ".git" folder in it. And then I go check, and there it is, a .git folder, that to me appeared out of nowhere, to my dismay! I ask the only other person who could have done something there and, surely enough, he didn't.

edit: I just noticed it only happens with master branch and the server's .git seem to have been created on october 1st, which can be right since I don't push to master that often.

The folder has 3gb and the bare folder, with all git structures beside the ghostly .git, has 6gb. While my local .git has 16 gb, so I'm not sure what's going on there... Even more, I can't check git log or git reflog. Either setting bare to true or false I get same error fatal: bad default revision 'HEAD'. And now I think it's already time to consider how to recover the repo...

But before I go through all the restoration dogma, I wonder:

  • Is there some kind of git activity log so I can see all commands issued in git, and by who?

Couldn't find anything similar, and I fear there isn't.

解决方案

That is why we have installed gitolite V3 (by simply cloning its repo and installing it like in this installation script) on our central git repo server.

Gitolite will intercept any git commands, and (in addition of its primary authorization framework feature) will record said commands in ~/.gitolite/logs/gitolite-log-xxx.

Here is an extract of such logs:

2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-git-configs,POST_COMPILE
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-gitweb-access-list,POST_COMPILE
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/commands/access,%,gitweb,R,any
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/commands/git-config,-r,%,gitweb\.
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-git-daemon-access-list,POST_COMPILE
2012-08-16.12:20:20     29507           system,/home/gitadmin/gitolite/bin/commands/access,%,daemon,R,any
2012-08-16.12:20:20     29507   END
2012-08-20.07:39:12     17683   ssh     ARGV=gitoliteadm        SOC=git-upload-pack 'gitolite-admin'    FROM=127.0.0.1
2012-08-20.07:39:12     17683           access(gitolite-admin, gitoliteadm, R, 'any'),-> refs/.*
2012-08-20.07:39:12     17683           trigger,Writable,access_1,ACCESS_1,gitolite-admin,gitoliteadm,R,any,refs/.*
2012-08-20.07:39:12     17683   pre_git gitolite-admin  gitoliteadm     R       any     -> refs/.*
2012-08-20.07:39:12     17683           system,git,shell,-c,git-upload-pack '/home/gitadmin/repositories/gitolite-admin.git'
2012-08-20.07:39:12     17683   END
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-git-configs,POST_COMPILE
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-gitweb-access-list,POST_COMPILE
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/commands/access,%,gitweb,R,any
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/commands/git-config,-r,%,gitweb\.
2012-08-16.12:20:19     29507           system,/home/gitadmin/gitolite/bin/triggers/post-compile/update-git-daemon-access-list,POST_COMPILE
2012-08-16.12:20:20     29507           system,/home/gitadmin/gitolite/bin/commands/access,%,daemon,R,any
2012-08-16.12:20:20     29507   END
2012-08-20.07:39:12     17683   ssh     ARGV=gitoliteadm        SOC=git-upload-pack 'gitolite-admin'    FROM=127.0.0.1
2012-08-20.07:39:12     17683           access(gitolite-admin, gitoliteadm, R, 'any'),-> refs/.*
2012-08-20.07:39:12     17683           trigger,Writable,access_1,ACCESS_1,gitolite-admin,gitoliteadm,R,any,refs/.*
2012-08-20.07:39:12     17683   pre_git gitolite-admin  gitoliteadm     R       any     -> refs/.*
2012-08-20.07:39:12     17683           system,git,shell,-c,git-upload-pack '/home/gitadmin/repositories/gitolite-admin.git'
2012-08-20.07:39:12     17683   END

这篇关于有没有git活动日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆