盒子

将本地hexo项目部署在阿里云git服务器

记一次将本地hexo博客变为git项目,并上传到自己的阿里云git服务器上

1.阿里云服务器上新建一个空的git项目,一定要git用户登录,不要root用户登录

1
ssh git@ip(你自己的IP地址)

Welcome to aliyun Elastic Compute Service!
[git@iZ2893sukboZ ~]#

我的git目录在 /home/git/repository,在该目录下新建一个空的git项目

1
git init --bare myBlog

回到本地,clone 阿里云git 服务器上刚刚新建的 myBlog git 项目

1
git clone git@ip:/home/git/repository/myBlog
cd myBlog
cp -R ~/BLOG myBlog # 将本地建好的BLOG 复制到空的myBlog项目里
git add .
git commit "将本地myBlog push 到git服务器上"
git push origin master

2.将myBlog 部署在阿里云本机

1
git clone /home/git/repository/myBlog

cd myBlog 

npm install

hexo g

hexo server

3 浏览器访问你的博客

http://ip:4000 # ip 为你的阿里云ip

4 安装nvm ,node, hexo

1
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash

nvm use v0.12.10

npm install hexo -g