Git站点部署-接收后挂钩中的签出不起作用 [英] Git site deployment - checkout in post-receive hook not working

查看:87
本文介绍了Git站点部署-接收后挂钩中的签出不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照本教程使用Git管理网站" ,使用Tower提交并将我的本地存储库推送到远程服务器.推送成功并显示以下消息:

I've followed this tutorial 'Using Git to manage a web site', using Tower to commit and push my local repo to the remote server. Pushing succeeds with the following message:

Pushing to ssh://user@mysite.com/~/git/tprevo.git
stdin: is not a tty
Counting objects: 40, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (37/37), done.
Writing objects: 100% (40/40), 171.95 KiB, done.
Total 40 (delta 3), reused 0 (delta 0)
To ssh://user@mysite.com/~/git/tprevo.git
 * [new branch]      master -> production
updating local tracking ref 'refs/remotes/production/production'

Successfully created tracking connection.

我已经验证了我的接收后挂钩正在执行,但是checkout命令没有将推送的代码添加到我认为已设置为我的工作目录的代码中.我一直想整天解决这个问题.

I've verified that my post-receive hook is executing, but the checkout command doesn't add the pushed code into what I believe I've set up as my working directory. I've been trying to figure this out all day.

接收后:

#!/bin/sh
GIT_WORK_TREE=/home/tprevo/public_html/tprevo git checkout -f

我是Git的新手,非常热衷于学习.调试此错误的最佳方法是什么?

I'm new to Git and very keen to learn. What's the best way to debug this?

推荐答案

好的...我有一个类似的设置...您的文件可执行吗? 请检查文件属性...

Okay ... I've got a similar setup ... is your file executable? Please check the files attributes ...

ls -la post-receive

如果它不是可执行文件,则需要对其进行chmod ...

If it's not executable then you need to chmod it ...

sudo chmod +x post-receive

更新

提示您有一个命名分支,您可能希望在checkout命令中为接收后钩子指定特定的分支...

Noticing that you have a named branch you may want to be specific in the checkout command for your post-receive hook ...

git checkout -f production

这篇关于Git站点部署-接收后挂钩中的签出不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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