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的話,可能還會出問題...


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM