邮寄收到不工作

时间:2017-07-22 22:52:28

标签: git git-post-receive

我尝试使用post receive将更改推送到我的服务器。 在主路径中:/ home / user 我执行了这些命令:

#!/bin/sh
git —work-tree=/home/user/public_html/testfolder —git-dir=/home/user/repos/test.git checkout -f
chmod +x post-receive

我将这些行放在收件后文件中:

git remote add prod ssh://user@domain.com:22/home/user/repos/test.git

它已成功创建。 然后我将一个新遥控器添加到我的本地仓库:

Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 430 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To ssh://domain.com:22/home/user/repos/test.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from prod.
然后我推了推: git push -u prod master

我收到了成功的消息:

jQuery(function($) {
        //$(".woocommerce-product-gallery__image > a > img").removeAttr("srcset");
        //MOBILE
        $(".woocommerce-product-gallery__image > a > img").bind("touchstart", function(event) {
        event.preventDefault();
        $(".woocommerce-product-gallery__image > a > img").each(function() {
            var src = $(this).attr("src"); // "/wp-content/uploads/2017/07/filename.jpg"
            var tarr = src.split('/');      // ["wp-content","uploads","2017","07","filename.jpg"]
            var year = tarr[tarr.length-3];
            var month = tarr[tarr.length-2];
            var data = tarr[tarr.length-1]; // "filename.jpg"
            var newdata = data.replace(data, "1" + data);
            $(this).attr("src","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            $(this).attr("srcset","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            });
                });
        $(".woocommerce-product-gallery__image > a > img").bind("touchend", function(event) {
        event.preventDefault();
        $(".woocommerce-product-gallery__image > a > img").each(function() {
            var src = $(this).attr("src"); // "/wp-content/uploads/2017/07/filename.jpg"
            var tarr = src.split('/');      // ["wp-content","uploads","2017","07","filename.jpg"]
            var year = tarr[tarr.length-3];
            var month = tarr[tarr.length-2];
            var data = tarr[tarr.length-1]; // "filename.jpg"
            var newdata = data.slice(1,data.length);
            $(this).attr("src","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            $(this).attr("srcset","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            }); 
                });
        //PC        
        $( ".woocommerce-product-gallery__image").hover(
            function() {
            $(".woocommerce-product-gallery__image > a > img").each(function() {
            var src = $(this).attr("src"); // "/wp-content/uploads/2017/07/filename.jpg"
            var tarr = src.split('/');      // ["wp-content","uploads","2017","07","filename.jpg"]
            var year = tarr[tarr.length-3];
            var month = tarr[tarr.length-2];
            var data = tarr[tarr.length-1]; // "filename.jpg"
            var newdata = data.replace(data, "1" + data);
            $(this).attr("src","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            $(this).attr("srcset","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            });
        },
            function() {
            $(".woocommerce-product-gallery__image > a > img").each(function() {
            var src = $(this).attr("src"); // "/wp-content/uploads/2017/07/filename.jpg"
            var tarr = src.split('/');      // ["wp-content","uploads","2017","07","filename.jpg"]
            var year = tarr[tarr.length-3];
            var month = tarr[tarr.length-2];
            var data = tarr[tarr.length-1]; // "filename.jpg"
            var newdata = data.slice(1,data.length);
            $(this).attr("src","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            $(this).attr("srcset","/wp-content/uploads/" + year + "/" + month + "/" + newdata);
            }); 
        });
                $(".woocommerce-product-gallery__image > a > img").on("click", function() {
        return false;
        });
    });

但是在testfolder(我的工作树)中没有文件 - 为什么?

请帮帮我。 谢谢!

1 个答案:

答案 0 :(得分:1)

  

在testfolder(我的工作树)中没有文件

确保您的server-side post-receive hook位于

user@domain.com:22/home/user/repos/test.git/hooks/post-receive

(并且可执行)