su git#切换git账户 mkdir ~/.ssh cd ./ssh sudo vim authorized_keys #输入生成的公钥 #若无法登录用vim /etc/ssh/sshd_config设置可以root登录mkdir #!!!注意ssh权限必须为700,authorized_keys权限必须为600!!!
直接创建git仓库
1 2 3 4 5 6 7
mkdir repo cd repo git init --bare blog.git cd blog.git/hooks vim post-receive git --work-tree=/www/wwwroot/120.53.236.54 --git-dir=/www/wwwroot/repo/blog.git checkout -f chmod +x post-receive # 赋予可执行权限
本地环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14
cd Desktop mkdir blog cd blog hexo init npm install hexo-deployer-git --save #编辑_config.yml #找到url: http://example.com #修改为 url: http://120.53.236.54 #将deploy改为 deploy: type: git repo: root@120.53.236.54:/www/wwwroot/repo/blog.git branch: master