这是一个坑
安装方式我就不说了,就是按照网上说的那样,我主要说一下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加密,方法如下。
import org.mindrot.jbcrypt.BCrypt;
public class BCryptDemo {
public static void main(String[] args) {
// Hash a password for the first time
String password = "123456";
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");
}
}
本文详细介绍了使用Hexo进行博客部署的正确配置方法,特别针对Windows环境下.sh脚本的替代方案,以及如何通过环境变量和_netrc文件避免每次部署时输入GitHub用户名密码。此外,还提供了使用bcrypt加密Hexo Admin登录密码的Java代码示例。
1534

被折叠的 条评论
为什么被折叠?



