0%

重新部署博客

修改图片地址,重新部署博客

重新部署博客

  1. 博客内容路径F:\simpleai.github.io\source\_posts,修改博客中图片地址
  2. F:\simpleai.github.io进入git bash
  3. 执行hexo clean
  4. 执行hexo g
  5. 执行hexo s,浏览器打开localhost:4000查看效果
  6. 执行hexo d

问题

执行hexo d

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
On branch master
nothing to commit, working tree clean
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /c/Users/han/.ssh/known_hosts to get rid of this message
Offending RSA key in /c/Users/han/.ssh/known_hosts:1
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (F:\simpleai.github.io\node_modules\hexo-util\1:21)
at ChildProcess.emit (events.js:314:20)
at ChildProcess.cp.emit (F:\simpleai.github.io\node_modules\cross-spawn\li:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/doting.html

解决

  1. 生成 SSH 密钥对。在命令行中输入以下命令:

    1
    ssh-keygen -t ed25519 -C "your_email@example.com"

    其中 “your_email@example.com“ 是您的 GitHub 账号注册时所用的邮箱地址。接着按照提示输入文件保存路径和密码等信息,或者直接按 Enter 使用默认选项。该命令将生成一个公钥文件和一个私钥文件。

    image-20230329232952423

  2. 将公钥添加到 GitHub 帐户。GitHub 网站依次单击 “Settings”,”SSH and GPG keys” 和 “New SSH key” 按钮。在 “Title” 字段中输入一个有意义的标识,例如 “My Hexo Blog SSH Key”,然后将公钥复制到 “Key” 字段中。最后单击 “Add SSH key” 按钮以将公钥添加到您的 GitHub 帐户中。

    image-20230329233151828

    image-20230329233247637

  3. 在 Hexo 博客的配置文件中指定 SSH URL。打开 Hexo 博客的根目录,找到 F:\simpleai.github.io\_config.yml 文件并打开它。在文件中找到以下行:

    1
    2
    3
    4
    5
    deploy:
    type: git
    # repo: https://github.com/simpleai/simpleai.github.io.git # 代表https协议
    repo: git@github.com:simpleai/simpleai.github.io.git # 代表ssh协议
    branch: master
  4. 将私钥添加到 SSH 代理。为了使 Git 能够使用您的 SSH 私钥进行认证,您需要将私钥添加到 SSH 代理中。在命令行中输入以下命令:

    1
    ssh-add ~/.ssh/id_ed25519

    如果提示Could not open a connection to your authentication agent.意味着 SSH 代理没有启动。

    1. 先执行eval "$(ssh-agent -s)",启动ssh代理

    2. 再执行ssh-add ~/.ssh/id_ed25519

    3. 输入 ssh-add -l 命令可以检查您的 SSH 密钥是否已添加到代理中,显示

      1
      4096 SHA256:abc123... my_key_name (RSA)
  5. 执行 hexo d