Gitlab post接收钩子不';行不通
我正在为本地托管在我的服务器上的gitlab上的项目使用自定义_钩子。下面是一段代码(我想在每次提交到存储库时将代码部署到特定文件夹): 我已经做了: 1) 将自定义钩子所有者更改为git 2) 将post接收文件所有者更改为git,并使其可执行 3) 改变目的地。文件夹所有者,并授予此文件夹的777权限 但是,当我试图承诺时,什么都没有发生Gitlab post接收钩子不';行不通,git,gitlab,gitlab-omnibus,Git,Gitlab,Gitlab Omnibus,我正在为本地托管在我的服务器上的gitlab上的项目使用自定义_钩子。下面是一段代码(我想在每次提交到存储库时将代码部署到特定文件夹): 我已经做了: 1) 将自定义钩子所有者更改为git 2) 将post接收文件所有者更改为git,并使其可执行 3) 改变目的地。文件夹所有者,并授予此文件夹的777权限 但是,当我试图承诺时,什么都没有发生 #!/opt/gitlab/embedded/bin/ruby # Fix the PATH so that gitlab-shell can find
#!/opt/gitlab/embedded/bin/ruby
# Fix the PATH so that gitlab-shell can find git-upload-pack and friends.
ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH']
#!/usr/bin/env ruby
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
# 1. Read STDIN (Format: "from_commit to_commit branch_name")
from, to, branch = ARGF.read.split " "
# 2. Only deploy if master branch was pushed
if (branch =~ /master$/) == nil
# puts "Received branch #{branch}, not deploying."
exit
end
# 3. Copy files to deploy directory
deploy_to_dir = File.expand_path('/etc/*specific folder*')
`GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f master`
# puts "DEPLOY: master(#{to}) copied to '#{deploy_to_dir}'"
# 4.TODO: Deployment Tasks
# i.e.: Run Puppet Apply, Restart Daemons, etc