首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gitblit阻塞钩子不叫

Gitblit阻塞钩子不叫
EN

Stack Overflow用户
提问于 2015-12-14 13:59:57
回答 1查看 192关注 0票数 2

我刚刚在gitblit安装的groovy文件夹中编辑了blockpush.groovy脚本。我只需“返回false”,以检查脚本是否被调用。此外,在测试脚本中,日志文件中没有写入任何内容。

代码语言:javascript
复制
Indicate we have started the script
logger.info("blockpush hook triggered by ${user.username} for ${repository.name}: checking ${commands.size} commands")

/*
 * Example rejection of pushes to the master branch of example.git
 */

def file1 = new File('C:\\workspace\\test.txt')
file1.write 'Working with files the Groovy way is easy.\n'

return false

我做错了什么?我正在吟诵,后来又在推

我没有注意到这段代码是重要的部分

代码语言:javascript
复制
 for (ReceiveCommand command : commands) {
        def updatedRef = command.refName
        if (updatedRef.equals('refs/heads/master')) {
            // to reject a command set it's result to anything other than Result.NOT_ATTEMPTED
            command.setResult(Result.REJECTED_OTHER_REASON, "You are not permitted to write to ${repository.name}:${updatedRef}")
            blocked = true
        }
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-14 14:32:36

您需要配置您的存储库以使用块钩子脚本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34268871

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档