Git:在远程裸仓库上进行本地获取后,未触发接收后挂钩

时间:2020-02-18 08:27:14

标签: git github git-bare

这里是上下文:

  • 计算机上的本地开发
  • 在Github上推送的源代码
  • 带有裸仓库的远程服务器部署
  • 在裸仓库上设置的post-receive钩子集,以部署在Apache目录上
  • 通过SSH部署新内容-> git remote添加live ssh://user@server/path/to/deploy.git,然后git push live master

远程裸仓库中接收后钩子的内容:

#!/bin/sh
GIT_WORK_TREE=/var/www/html git checkout -f

一切都可以在远程正​​常运行,但是我希望能够直接从远程服务器上的裸仓库中部署。下一步将是一个名为https的脚本,以便在SSH不可用时进行部署。

在我的本地计算机上推送:

git push origin master:master至https://github.com/Myself/repo.git
d8856273 .. e3fe4b4c 主->主

在裸仓库中,在获取之前

〜/ deploy.git $ git rev-parse --short HEAD

d885627

从远程服务器本地获取:

〜/ deploy.git $ git fetch https://github.com/Myself/repo.git master:master

来自https://github.com/Myself/repo

d885627 .. e3fe4b4 大师->大师

新内容在那里。但是,/ var / www / html保持不变。

似乎在获取后未触发接收后挂钩。我该如何解决呢?

0 个答案:

没有答案