zoukankan      html  css  js  c++  java
  • gitlab hook declined错误

    在向gitlab提交工程的时候,出现错误提示:

    remote: GitLab: You are not allowed to access master!
    remote: error: hook declined to update refs/heads/master
    To sa_gitlab@192.168.xxx:xxx/xxx.git
    ! [remote rejected] master -> master (hook declined)

    这个问题主要是由于git工程里的hooks/post-receive和update引起的。可以删除这两个文件;

    但是问题的根源不在这,在新建工程的hooks里面的这两个文件只是ln -s 出来的软链接,关键问题是,这两个软链接链错了位置。

    查看 gitlab-shell/lib/gitlab_project.rb这个创建新工程的文件,里面有

    def add_project
       FileUtils.mkdir_p(full_path, mode: 0770)
       #cmd = "cd #{full_path} && git init --bare && #{create_hooks_cmd}"
       cmd = "cd #{full_path} && git init --bare"
       system(cmd)
     end
     def create_hooks_cmd
       pr_hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive')
       up_hook_path = File.join(ROOT_PATH, 'hooks', 'update')
       #2013年11月5日 <feixiang> path alway add /home/repositories/ ,but what we want is a absolute path , comment it
       "ln -s #{pr_hook_path} #{full_path}/hooks/post-receive && ln -s #{up_hook_path} #{full_path}/hooks/update"
     end

    把create_hooks_cmd注释了即可,但是,这样在后面如果要在网页修改hooks的话,可能还会出问题...

  • 相关阅读:
    vertical-align
    剑指offer刷题
    ES6 promise
    wangyi准备
    spring定时器
    xshell下linux常用操作
    HSSFWorkbook生成excel文件
    梳理并分解继承体系
    JSON格式数据转换
    部署项目
  • 原文地址:https://www.cnblogs.com/trying/p/3408660.html
Copyright © 2011-2022 走看看