美文网首页
git实现代码部署

git实现代码部署

作者: xiasix | 来源:发表于2016-01-15 09:46 被阅读0次

啊 大周末的 来加班  活都让小伙子们干了  正好有新项目 之前代码部署全部用svn的hooks实现的 一直想转成git  今天研究研究

yum install git git-daemon

useradd git

chown -R git:git /home/git

su git

cd ~

mkdir .ssh

chmod 700 .ssh

touch .ssh/authorized_keys

chmod 600 .ssh/authorized_keys

禁止git用户shell登录

sudo vim /etc/passwd

查找passwd的git那行,可以看到下面类似的文本:

git:x:1000:1000::/home/git:/bin/sh

我们把shell换一下,改成git-shell:

git:x:1000:1000::/home/git:/usr/bin/git-shell

如果我们想换成git登陆,会提示下面的信息:

su git

fatal: What do you think I am? A shell?

cd

mkdir anhaocom.git

cd anhaocom.git/

git --bare init

vi /home/git/anhaocom.git/hooks/post-receive

添加上

#!/bin/sh

#GIT_WORK_TREE=/Data/webapps/anhaocom git checkout prod -f

git --work-tree=/Data/webapps/anhaocom --git-dir=/home/git/anhaocom.git checkout -f

参考文档

http://zoomq.qiniudn.com/ZQScrapBook/ZqFLOSS/data/20130730120622/index.html

http://git-scm.com/book/zh/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git

http://icyleaf.com/2012/03/apps-auto-deploy-with-git/

https://coderwall.com/p/xczkaq

http://happycasts.net/episodes?tag_id=2

http://yuguo.us/weblog/git-feature/

http://icyleaf.com/2012/03/apps-auto-deploy-with-git/

http://my.oschina.net/liseor/blog/100899

相关文章

网友评论

      本文标题:git实现代码部署

      本文链接:https://www.haomeiwen.com/subject/oedhkttx.html