git post-receive hook没有运行 [英] git post-receive hook not running

查看:176
本文介绍了git post-receive hook没有运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的repo服务器端,我可以成功提交并从本地计算机推送。但是,接收后挂接未运行。详细信息:


  • 使用SSH作为协议
  • 我已将标准post-receive.sample topost-receive

  • 该文件具有 -rwxr-xr-x 权限

  • 该文件由拥有该repo的同一用户拥有,该用户与登录并推送的SSH用户相同
  • 实际推送顺利进行;文件被更新 - 这只是不运行的钩子

  • 我试图在钩子前后放置 echo一些文本但未显示(请参阅:发布提交挂钩未运行)。

  • 钩子脚本包含在下面,尽管这似乎不会导致问题。

  • 在Ubuntu 10.04上使用git 1.7.0.4



  • $ p
    $ b $ pre $ user @ server:/ home / repos / project1 / hooks#cat post-receive
    #!/ bin / sh
    echoHook is running ...
    export GIT_WORK_TREE = / home / web / project1 / www /
    git checkout -f
    rm -rf / home / web / project1 / www / temp /


    解决方案

    该问题与安装文件系统有关。分区被挂载为 noexec ,因此不能执行任何文件。这导致挂钩不能运行。我删除了 noexec 标志,现在它工作得很好。

    I have a bare repo server-side, and I am able to successfully commit and push from my local machine. However, the post-receive hook is not running. Details:

    • Using SSH as protocol
    • I have renamed the standard "post-receive.sample" to "post-receive"
    • This file has -rwxr-xr-x permissions
    • The file is owned by the same user that owns the repo, which is the same SSH user that logs in and pushes
    • The actual pushing goes fine; files are updated - it's just the hook that does not run
    • I tried putting echo "Some text" before and after the hook, but this is not shown (see: Post Commit Hook Not Running).
    • Hook script is included below, although this appears not to be causing the problem
    • Using git 1.7.0.4 on Ubuntu 10.04

    .

    user@server:/home/repos/project1/hooks# cat post-receive
    #!/bin/sh
    echo "Hook is running..."
    export GIT_WORK_TREE=/home/web/project1/www/
    git checkout -f
    rm -rf /home/web/project1/www/temp/
    

    解决方案

    The issue was related to the mounting of the filesystem. The partition was mounted as noexec, and therefore no files could be executed. This caused the hook not to run. I removed the noexec flag and it now works just fine.

    这篇关于git post-receive hook没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆