2010-12-07 32 views
6

在我的遠程盒子上,我初始化了一個裸露的git倉庫。在hooks目錄中,我初始化後接收更新後和更新鉤子與下面的腳本:Git推送HTTP不激活遠程鉤子

#!/bin/bash 
echo $0 [email protected] >> /tmp/githooks.log 

在我的本地中,我已經克隆的資源庫,增加了測試文件,承諾它並將更改推回到遠程盒子。

$ git clone https://remote/git/sandbox.git sandbox 
$ cd sandbox 
$ touch asdf 
$ git add asdf 
$ git commit -a 
[master (root-commit) 37505de] zxcv 
0 files changed, 0 insertions(+), 0 deletions(-) 
create mode 100644 asdf 
$ git push origin master 
Fetching remote heads... 
    refs/ 
    refs/heads/ 
    refs/tags/ 
updating 'refs/heads/master' 
    from 0000000000000000000000000000000000000000 
    to 37505de9c22b0aee84e0071190f4f58728770675 
    sending 3 objects 
    done 
Updating remote server info 
To https://remote/git/sandbox.git 
* [new branch]  master -> master 

但是,遠程計算機上的/tmp/githooks.log爲空。但是,如果我在遠程計算機上克隆存儲庫,則會成功調用掛接。

git掛鉤不能與http-push一起使用嗎?

+0

呵呵。這個明顯的答案是智能HTTP(git http-backend)。 http://progit.org/2010/03/04/smart-http.html – 2010-12-07 01:05:32

回答

8

With Git protocols,您將啓用不同的功能。
對於HTTP,this thread總結了問題:

「問題」在這裏(這是非常方式HTTP協議設計)是,它不是混帳上遠程端庫更新推(它知道掛鉤),但web服務器通過WebDAV
而Web服務器對鉤子一無所知。當「智能」HTTP協議得到實現時(當前處於設計階段,我認爲只是在設計協議之後),也許這會得到改善。

當你評論,smart http將是答案。

alt text

,因爲它需要具有安裝了服務器,在需要HTTP傳輸的先前咒語只有一個簡單的網絡服務器上的GIT中的二進制該特徵被稱爲「智能」 HTTP與「啞」 HTTP 。
它與客戶進行真正的對話,而不只是簡單地推送數據。