gogs設置Git鉤子post-receive報:Fail to execute custom post-receive hook

在gogs中給倉庫設置git鉤子要實現項目自動部署,但是鉤子設置後沒有起作用,查看gogs中的post-receive的log文件,顯示:

cat  /home/gogs/log/hooks/post-receive.log 
2020/04/14 14:17:40 [FATAL] [...its/gogs/cmd/hook.go:274 runHookPostReceive()] Fail to execute custom post-receive hook: exit status 128
2020/04/14 14:24:12 [FATAL] [...its/gogs/cmd/hook.go:274 runHookPostReceive()] Fail to execute custom post-receive hook: exit status 1
2020/04/14 14:31:24 [FATAL] [...its/gogs/cmd/hook.go:274 runHookPostReceive()] Fail to execute custom post-receive hook: exit status 1

post-receive鉤子文件內容如下:

#!/bin/bash
unset $(git rev-parse --local-env-vars);
cd /home/demo/
git pull origin master 

翻看gogs的issues後發現其中有人給出將鉤子中的第一行做修改後即可正常運行,原因未知,修改後的文件如下:

#!/usr/bin/env bash
unset $(git rev-parse --local-env-vars);
cd /home/demo/
git pull origin master 

issues地址:https://github.com/gogs/gogs/issues/5076

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章