hexo tutorial (b) - Use hexo + github to build personal blog

In the previous section which we successfully used the hexo build a local blog, this section we will talk about how it will be deployed to Github blog home page

Use hexo + github build online personal blog

New github repository

  • Log on to their Github, create a new warehouse, named username.github.io, which usernameis your user name, select the Initialiaze this repository with a README, creating depots, the process shown below

  • Once created, selecting Settings, turn down Github Pages, as shown in FIG.

  • We have access to their own username.github.io, as shown in Figure

  • Returns username.github.iowarehouse, Git copy address, shown in FIG.

Local operation

The end of the above steps, we return to a local folder

  • We / Blog / hexo / folder, find the _config.ymlfile, open it with a text editor. as the picture shows

  • The lowest deploychange the content shown below, in which the repo address is the address we have just Git copy, modify, save and exit after the better.
    [Note] modify the content :there is a space between and behind the letters, otherwise the subsequent content will complain

  • Next, we would not consider new article, run Git Bash in npm install hexo-deployer-git --savethe command, wait for some time, as shown in Figure

  • The last execution hexo deployor hexo d
    [Note] This step is necessary to ensure public have the machine on Github, you can find their own solutions here, I ran into a problem: judging by the online method, I have successfully configured the public key, but each execution will let me enter the username and password again
    hexo d

Later, I found a way on the Internet:

  1. New system variable called HOME, the value of the variable%USERPROFILE%
  2. C:/users中的个人文件夹下面新建一个名为_netrc的文件,编辑内容为
machine github.com
login username
password userpassword

其中usernameuserpassword是Github的用户名和密码,这样就不必再重复输入用户名和密码了,但使用明文存储账号密码也存在不安全的风险

后来!当我在编辑博客的时候,我发现:即使删了这个文件,再去执行hexo d也不需要输入用户名和密码了,原因不明。。。

  • 最后,成功部署

  • 在浏览器中访问username.github.io,我们发现之前运行在本地的博客已经成功发布到网站上面去了

  • 到这里,我们就成功地将Github部署到了Internet上面,下一节我们来谈一谈如何新建一篇博客并发布。

Guess you like

Origin www.cnblogs.com/xrblog/p/11585902.html