git裸仓
添加用户
1 | adduser git |
拷贝秘钥
1 | ssh-copy-id -i ~/.ssh/id_rsa [email protected] |
创建裸仓
1 | cd /home/git && git init --bare milosmemo.git && chown -R git:git milosmemo.git |
禁用shell登录
1 | sed -i 's/\/home\/git:\/bin\/bash/\/home\/git:\/usr\/bin\/git-shell/' /etc/passwd |
实现自动部署
1 | cd /var/www && mkdir milosmemo && chown -R git:git milosmemo && cd /home/git/milosmemo.git/hooks && mv post-update.sample post-update && chmod +x post-update && |
原文作者: Milo
原文链接: https://milosmemo.com/2019/09/26/git%E8%A3%B8%E4%BB%93/
许可协议: 本文采用CC BY 4.0 CN许可协议。转载请注明出处