hexo admin注意事项

版权声明:本文虽为博主原创文章,但你转了博主也不知道,所以放心的转吧。 https://blog.csdn.net/javaer_lee/article/details/87877641

这是一个坑

安装方式我就不说了,就是按照网上说的那样,我主要说一下Deploy中的脚本怎么配置,网上都是类似这种

./xxxx.sh

完了我也傻不拉几的按照这种方式写,后来发现这就是一个脚本,你不用deploy就用命令行运行也是一样的,
admin只是一个写markdown的工具,部署只是提供给你一个快捷键罢了,问题是我是Windows,居然也用.sh真是尴尬,改成.bat路径前面也不需要.这也是linux下的写法。deployCommand: ‘hexo-generate.bat’ 就行了。

tips

每次hexo deploy的时候是不是都要输入github用户名密码?
可以这样做

先配置一个环境变量

接着在你的用户目录(C:\Users\username)下新建一个叫 _netrc的文件(没有拓展名)
编辑这个文件

  • machine github.com
  • login username
  • password password

设置好这些后,当你再次部署时,就不用输入用户名和密码了。

tips2

hexo admin可以配置用户名和密码,密码需要用bcrypt加密,方法如下。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class BCryptDemo {
  public static void main(String[] args) {
   // Hash a password for the first time
     String password = "testpassword";
    String hashed = BCrypt.hashpw(password, BCrypt.gensalt());
    System.out.println(hashed);
  // gensalt's log_rounds parameter determines the complexity
  // the work factor is 2**log_rounds, and the default is 10
  String hashed2 = BCrypt.hashpw(password, BCrypt.gensalt(12));
 
  // Check that an unencrypted password matches one that has
  // previously been hashed
  String candidate = "testpassword";
  //String candidate = "wrongtestpassword";
  if (BCrypt.checkpw(candidate, hashed))
    System.out.println("It matches");
  else
  System.out.println("It does not match");
  }
}

猜你喜欢

转载自blog.csdn.net/javaer_lee/article/details/87877641