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的话,可能还会出问题...

  • 相关阅读:
    【转】JSch
    【转】JSch
    【转】class卸载、热替换和Tomcat的热部署的分析
    关于Tomcat自动加载更新class的小技巧
    MySQL中order by中关于NULL值的排序问题
    MySQL触发器使用详解
    QuartZ Cron表达式
    JDBC的URL设置allowMultiQueries的原因
    CRT:C运行库简介
    IntelliJ IDEA安装AngularJS插件
  • 原文地址:https://www.cnblogs.com/trying/p/3408660.html
Copyright © 2011-2022 走看看