码迷,mamicode.com
首页 > 其他好文 > 详细

git hook 自动部署

时间:2017-02-12 22:23:50      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:data   fail   mic   ack   master   tac   cal   pos   ida   

1. 当前虚拟站点根目录的 .git/ 权限 

2. 当前项目裸仓库创建 hooks/post-receive 文件,并给予x 的权限

3. 复制如下内容

#!/bin/sh
unset $(git rev-parse --local-env-vars)
REPO="git@123.111.11.11:edc2.git"
#BRANCH=`echo $refname | sed -n ‘s/^refs\/heads\///p‘`
#BRANCH_DIR="/root"
SSH_DEST="root@iZ255rhjhjhjhjhjhjt7otpZ"
ssh "$SSH_DEST" /bin/sh <<-EOF
cd /alidata/www/v2.edc.com
git pull origin master
EOF

  

*******************

可能有如下问题

su - git
ssh-keygen
ssh-copy-id michael@docker.example.com
ssh michael@docker.example.com

 

http://stackoverflow.com/questions/37455781/gitlab-post-receive-hook-host-key-verification-failed

 

git hook 自动部署

标签:data   fail   mic   ack   master   tac   cal   pos   ida   

原文地址:http://www.cnblogs.com/yangyuqiu/p/6391813.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!