Github + Hexo + Shoka搭建个人博客以及遇到的部分问题

博客预览:

主页:

文章:

博客语言链接:

全部分类 |mmjon = = 不在能知,乃在能行

Shoka官方博客:

Yume Shoka = 優萌初華 = 有夢書架 (lostyu.me)

1、准备

1、github账号 :自行去github官网注册即可 地址:GitHub

2、Node.js环境 :去官网下载安装即可

3、Git环境 : 下载gitbash

1.1 Node.js环境

官网下载地址:https://nodejs.org/en/download/prebuilt-installer

选择预构建->默认版本直接下载

下载好之后一直next(相切换路径的也可以自行选择,没有什么影响)即可。

之后测试是否安装成功

//查看版本
node -v
//查看npm版本
npm -v

1.2 安装git

大家可以通过git官方去进行下载:https://git-scm.com/download/

选择对应的操作系统即可,同样也不要求版本

安装之后同样使用命令查看版本

git -v

2、安装Hexo

首先我们现在创建一个文件,用来保存我们一会npm安装的hexo

然后在在该目录下打开cmd,运行一下命令(建议魔法上网,没有魔法的可以尝试多运行几次)

//安装hexo
npm install -g hexo-cli
//查看是否安装成功
hexo -v
//初始化项目
hexo init
//启动查看是否构建成功
hexo server

hexo

之后我们访问http://127.0.0.1:4000/ 查看是否可以正常启动

打开能看到这个页面就是Hexo构建成功了。之后我们可以找一些好看的主题部署上去,这里我选择的是Shoka主题。

3、Shoka主题安装

3.1 安装主题

方式一、git命令

git clone https://github.com/amehime/hexo-theme-shoka.git ./themes/shoka

方式二、访问github官网下载

https://github.com/amehime/hexo-theme-shoka

这里使用第一种方式进行安装

在刚刚我们创建好的目录中打开cmd

运行git命令

安装好之后我们在themes中就能看到Shoka文件夹

之后我们还需要安装渲染插件,各种插件的用途可以到官网上进行查看

Step.1 依赖插件 - Theme Shoka Documentation - 二进制杂谈 - 计算机科学 | mmjon = = 不在能知,乃在能行

其中前两个是必须要安装的(本人尝试过不安装博客也能正常打开,就是不知道会不会出现什么问题=。=)(这里发现好像不用魔法上网会更快一些)

 npm i hexo-renderer-multi-markdown-it --savenpm i hexo-autoprefixer --savenpm i  hexo-algolia --savenpm i hexo-algoliasearch --savenpm i hexo-symbols-count-time --savenpm i hexo-feed --save

之后我们去配置文件中配置一下主题

首先修改根目录下的_config.yml文件

将图中位置修改为Shoka,之后启动看看能不能正常运行

//hexo generate 命令用于生成静态文件,一般可以简写为 hexo g 
//hexo deploy 命令用于部署网站,一般可以简写为 hexo d
hexo g d   
//hexo server 命令用于启动本地服务器,一般可以简写为 hexo s
hexo s

发现可以正常运行了

之后我们继续进行配置,以下是我的配置,大家可以参考一下

其中这里

建议大家暂时不要改,这里是配置我们git push到github上的,如果设置了我们将无法在本地打开了(这里还没到这里的配置)这里我们还没有安装deploy的插件,后面会提到

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/# Site
title:      //标题
subtitle: '不在能知,乃在能行'   //主页标题下的文字
description: '欢迎来到mmjon的笔记空间~这里主要会记录编程学习笔记🌸'   //主页个人介绍下的文字
keywords:
author: mmjon       
language: zh-CN       //默认为英文,这里可以自己设置成中文
timezone: ''# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
## 这里应该是设置我们的网站地址的,其实不改好像也没啥问题
url: http://mmjon.github.io
permalink: :title/
permalink_defaults:
pretty_urls:trailing_index: true # Set to false to remove trailing 'index.html' from permalinkstrailing_html: true # Set to false to remove trailing '.html' from permalinks# Directory   目录下的各种小部件  
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:enable: true # Open external links in new tabfield: site # Apply to the whole siteexclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
syntax_highlighter: highlight.js
highlight:line_number: trueauto_detect: falsetab_replace: ''wrap: truehljs: false
prismjs:preprocess: trueline_number: truetab_replace: ''# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:path: ''per_page: 10order_by: -date# Category & Tag
default_category: uncategorized
category_map:
tag_map:# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: shoka# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:type: gitrepo: git@github.com:mmjon/mmjon.github.io.gitbranch: main

依旧使用 hexo g d hexo s重新构建看看效果

之后去修改主题中的各种配置,打开 thems/shoka 找到_config.yml文件

大家依旧可以参考我的来改

# Alternate site name
alternate: mmjonopen_graph:#twitter_id:#google_plus:#fb_admins:#fb_app_id:# Assets
statics: / #//cdn.jsdelivr.net/gh/mmjon/mmjon.github.io@latest/
css: css
js: js
images: images# themes/shoka/source/images/***
favicon:apple_touch_icon: /apple-touch-icon.pngsafari_pinned_tab: /logo.svgandroid_manifest: /manifest.jsonms_browserconfig: /browserconfig.xml# Dark Mode
# By default, the page judges whether to turn on the dark mode according to the device settings or user selection
# if `true`, the page will be displayed directly as Dark Mode, unless the user makes another choice
# 夜间模式
darkmode: false# By default the page will automatically scroll to the last viewed position
# if `false`, automatic positioning will be turned off
# 自动定位 自动定位到上次浏览的位置
auto_scroll: true# Whether to show the loading cat
# 是否显示页面加载动漫 就是每次都看到的那个猫猫
loader:start: true # When entering the pageswitch: false # When switching to another page# click with Firework
# 页面特效 单击页面的烟花效果
fireworks:enable: truecolor:- "rgba(255,182,185,.9)"- "rgba(250,227,217,.9)"- "rgba(187,222,214,.9)"- "rgba(138,198,209,.9)"# 加载谷歌字体
font:enable: true# Font options:# `external: true` will load this font family from `host` above.# `family: Times New Roman`. Without any quotes.# `size: x.x`. Use `em` as unit. Default: 1 (16px)# Global font settings used for all elements inside <body>.global:external: truefamily: Mulishsize:# Font settings for alternate title.# 备用字体logo:external: truefamily: Fredericka the Greatsize: 3.5# Font settings for site title.# 站点字体title:external: truefamily: Noto Serif JPsize: 2.5# Font settings for headlines (<h1> to <h6>).headings:external: truefamily: Noto Serif SCsize:# Font settings for posts.posts:external: truefamily:# Font settings for <code> and code blocks.codes:external: truefamily: Inconsolata# project of https://www.iconfont.cn/
# //at.alicdn.com/t/font_1832207_c8i9n1ulxlt.css => 1832207_c8i9n1ulxlt
iconfont: "1832207_igi8uaupcus"# 菜单
menu:首页: / || home关于: /about/ || user文章:default: / || feather归档: /archives/ || list-alt分类: /categories/ || th标签: /tags/ || tagsfriends: /friends/ || heartlinks: /links/ || magic# Social Links
# Usage: `Key: permalink || icon || color`
# Key is the link label showing to end users.
# Value before `||` delimiter is the target permalink,
# secend value is the name of Font icon.
social:github: https://github.com/mmjon || github || "#191717"#google: https://plus.google.com/yourname || google#twitter: https://twitter.com/yourname || twitter || "#00aff0"#zhihu: https://www.zhihu.com/people/yourname || zhihu || "#1e88e5"#music: https://music.163.com/#/user/home?id=yourid || cloud-music || "#e60026"#weibo: https://weibo.com/yourname || weibo || "#ea716e"#about: https://about.me/yourname || address-card || "#3b5998"#email: mailto:yourname@mail.com || envelope || "#55acd5"#facebook: https://www.facebook.com/yourname || facebook#stackoverflow: https://stackoverflow.com/yourname || stack-overflow#youtube: https://youtube.com/yourname || youtube#instagram: https://instagram.com/yourname || instagram#skype: skype:yourname?call|chat || skype#douban: https://www.douban.com/people/yourname/ || doubansidebar:# Sidebar Position.# position: leftposition: left# Replace the default avatar image and set the url here.avatar: avatar.jpgwidgets:# if true, will show random posts# 显示随机文章random_posts: true# if true, will show recent comments# 显示最近评论recent_comments: truefooter:# Specify the date when the site was setup. If not defined, current year will be used.# 页尾全站统计局since: 2018icon:name: sakura rotate# Change the color of icon, using Hex Code.color: "#ffc0cb"# Dependencies: https://github.com/theme-next/hexo-symbols-count-timecount: truepowered: true# 文章界面统计
post:# Dependencies: https://github.com/theme-next/hexo-symbols-count-timecount: true# 奖励 这里我不需要
# Reward (Donate)
#reward:
#  # If true, reward will be displayed in every article by default.enable: trueaccount:wechatpay: /wechatpay.pngalipay: /alipay.pngpaypal: /paypal.png# TagCloud settings for tags page.
tagcloud:# All values below are same as default, change them by yourself.min: 16 # Minimun font size in pxmax: 22 # Maxium font size in pxstart: "#72cecf" # Start color (hex, rgba, hsla or color keywords)end: "#ffbac3" # End color (hex, rgba, hsla or color keywords)amount: 200 # Amount of tags, change it if you have more than 200 tags# ---------------------------------------------------------------
# Third Party Plugins & Services Settings
# ---------------------------------------------------------------# Creative Commons 4.0 International License.
# See: https://creativecommons.org/share-your-work/licensing-types-examples
# Available values of license: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
# CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
creative_commons:license: by-nc-salanguage: zh-CN  # deed.zh# Comments
# Valine
# For more information: https://github.com/amehime/MiniValine
valine:appId: # 配置你的appIdappKey: # 配置你的appKeyplaceholder: ヽ(○´∀`)ノ♪ # Comment box placeholderavatar: mp # Gravatar style : mp, identicon, monsterid, wavatar, robohash, retropageSize: 10 # Pagination sizelang: zh-CNvisitor: true # Article reading statistic 文章阅读量统计NoRecordIP: false # Whether to record the commenter IPserverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)powerMode: truetagMeta:visitor: 新朋友master: 主人friend: 小伙伴investor: 金主粑粑tagColor:master: "var(--color-orange)"friend: "var(--color-aqua)"investor: "var(--color-pink)"tagMember:master:# - hash of master@email.com# - hash of master2@email.comfriend:# - hash of friend@email.com# - hash of friend2@email.cominvestor:# - hash of investor1@email.com# bgm 背景音乐
audio:- title: 列表1list:- https://music.163.com/#/playlist?id=2943811283- https://music.163.com/#/playlist?id=2297706586- title: 列表2list:- https://music.163.com/#/playlist?id=2031842656# random image api
# 随机图库
image_server: # "https://api.btstu.cn/sjbz/api.php"# Algolia Search
# For more information: https://www.algolia.com
search:hits:per_page: 10# Dependencies: https://github.com/amehime/hexo-renderer-multi-markdown-it
pangu: true# Quicklink Support
# For more information: https://github.com/GoogleChromeLabs/quicklink
quicklink:# Custom a time in milliseconds by which the browser must execute prefetching.timeout: 3000# Default (true) will attempt to use the fetch() API if supported (rather than link[rel=prefetch]).priority: true# For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores.# See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patternsignores:# ---------------------------------------------------------------
# analytics & SEO Settings
# ---------------------------------------------------------------
baidu_analytics: # <app_id># Disable Baidu transformation on mobile devices.
disable_baidu_transformation: true# Automatically add external URL with Base64 encrypt & decrypt.
exturl: true# Google Webmaster tools verification.
# See: https://www.google.com/webmasters
google_site_verification:# Bing Webmaster tools verification.
# See: https://www.bing.com/webmaster
bing_site_verification:# Yandex Webmaster tools verification.
# See: https://webmaster.yandex.ru
yandex_site_verification:# Baidu Webmaster tools verification.
# See: https://ziyuan.baidu.com/site
baidu_site_verification:# Enable baidu push so that the blog will push the url to baidu automatically which is very helpful for SEO.
baidu_push: # 渲染md文件
markdown:render: # 渲染器设置html: false # 过滤 HTML 标签xhtmlOut: true # 使用 '/' 来闭合单标签 (比如 <br />)。breaks: true # 转换段落里的 '\n' 到 <br>。linkify: true # 将类似 URL 的文本自动转换为链接。typographer:quotes: '“”‘’'plugins: # markdown-it 插件设置- plugin:name: markdown-it-toc-and-anchorenable: trueoptions: # 文章目录以及锚点应用的 class 名称,shoka 主题必须设置成这样tocClassName: 'toc'anchorClassName: 'anchor'- plugin:name: markdown-it-multimd-tableenable: trueoptions:multiline: truerowspan: trueheaderless: true- plugin:name: ./markdown-it-furiganaenable: trueoptions:fallbackParens: "()"- plugin:name: ./markdown-it-spoilerenable: trueoptions:title: "你知道得太多了"# minify 配置,压缩css/js/html
minify:html:enable: trueexclude: # 排除 hexo-feed 用到的模板文件- '**/json.ejs'- '**/atom.ejs'- '**/rss.ejs'css:enable: trueexclude:- '**/*.min.css'js:enable: truemangle:toplevel: trueoutput:compress:exclude:- '**/*.min.js'# 代码高亮
highlight:enable: trueprismjs:enable: trueautoprefixer:exclude:- '*.min.css'# 全局搜索
algolia:appId:  #Your appIdapiKey:  #Your apiKeyadminApiKey:  #Your adminApiKeychunkSize: 5000indexName: "" #"shoka"fields:- title- path- categories- content:strip:truncate,0,2000- gallery- photos- tagskeywords: java,git,springcloud #站点关键词,用 “,” 分隔feed:limit: 20order_by: "-date"tag_dir: falsecategory_dir: falserss:enable: truetemplate: "themes/shoka/layout/_alternate/rss.ejs"output: "rss.xml"atom:enable: truetemplate: "themes/shoka/layout/_alternate/atom.ejs"output: "atom.xml"jsonFeed:enable: truetemplate: "themes/shoka/layout/_alternate/json.ejs"output: "feed.json"#! ---------------------------------------------------------------
#! DO NOT EDIT THE FOLLOWING `vendors` SETTINGS
#! UNLESS YOU KNOW WHAT YOU ARE DOING
#! Script dependencies will be combined with jsDelivr (cdn.jsdelivr.net)
#! ---------------------------------------------------------------
vendors:css:katex: npm/katex@0.12.0/dist/katex.min.csscomment: css/comment.cssfancybox: combine/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css,npm/justifiedGallery@3.8.1/dist/css/justifiedGallery.min.cssjs:pace: npm/pace-js@1.0.2/pace.min.jspjax: npm/pjax@0.2.8/pjax.min.jsfetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.jsanime: npm/animejs@3.2.0/lib/anime.min.jsalgolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.jsinstantsearch: npm/instantsearch.js@4/dist/instantsearch.production.min.jslazyload: npm/lozad@1/dist/lozad.min.jsquicklink: npm/quicklink@2/dist/quicklink.umd.jsfancybox: combine/npm/jquery@3.5.1/dist/jquery.min.js,npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js,npm/justifiedGallery@3.8.1/dist/js/jquery.justifiedGallery.min.jsvaline: gh/amehime/MiniValine@4.2.2-beta10/dist/MiniValine.min.jscopy_tex: npm/katex@0.12.0/dist/contrib/copy-tex.min.jschart: npm/frappe-charts@1.5.0/dist/frappe-charts.min.iife.min.js

之后保存,继续使用hexo g hexo s命令重新构建

其中提示一些没必要理

主题的基本配置算是完成了,之后我们去部署到github上即可

4、部署到github

4.1 创建github page

首先我们需要去创建一个库

点击右上角+号 --> new repository

之后按照图中配置即可

之后我们需要去new 一个文件

之后写一些html的内容,并保存为index.html

创建好之后找到setting

找到page

发现github page已经生效了,我们去访问即可

如果此时你访问之后没有任何内容,不用着急,可能是github正在加载数据,等一会即可,当然,如果等了好久还没加载出来,你可以查看是不是创建时目录输入错误了

之后我们需要把项目部署到github上,那么我们有两种方式进行部署

1、最简单的方法,直接将public文件夹中的所有内容复制到github上(但是后续更改配置可能不是很好用)

2、第二种方式,配置github的私钥和公钥,同时npm安装hexo-deployer-git 部署插件

4.2 github配置私钥公钥实现git push

这里我参考的是官方文档进行配置:

首先找到github中的settings

右上角点击头像-->settings

之后找到SSH and GPG keys 新建一个ssh密钥

可以看到需要我们去填写一个sshkey

这是我们需要打开git bash 进行生成我们的keys

首先我们需要查看我们电脑上是否已经存在这么一个key

打开git bash

输入

cd ~/.ssh
ls
# 查看我们目录中是否有id_edxxx.pub或者id_rsa 如果存在的话说明我们电脑上已经有ssh密钥了

如果没有的话,我们可以使用命令进行生成,

ssh-keygen -t rsa -C "xxx@xxx.com"    //“”中输入你们的注册邮箱

之后一直回车即可

之后使用cat命令进行查看

cat id_rsa.pub 

给他全部复制下来放到我们刚刚打开的页面中

add即可

输入密码验证,可以看到我们已经创建好了

也就是说现在我们可以使用git push了

但是我们依然不能把我们的项目push到github中,因为这里我们需要把刚刚说到的插件给他安装上

npm install hexo-deployer-git --save   

并把刚刚的代码给他复制上

deploy:type: gitrepo: git@github.com:username/username.github.io.gitbranch: main

代码复制到我们的根目录下的_config.yml文件中 注意更换repo中的username为你们github的username

这里我是KELYJ 所以我改成 KELYJ/KELYJ.github.io 即可

之后使用

hexo clean
hexo g
hexo d

即可部署到github上。之后访问github我们设置好的存储库即可

KELYJ.github.io

成功,但是发现没有图片,这里的解决方法我放到下面的遇到的问题中了。

之后就是文章发布了,这里我们可以找到hexo-test\themes\shoka\example\source\_posts

目录下,官方给了好多文章模板,我们直接复制粘贴修改文件名以及编写markdown即可。

之后把文章放到hexo-test\source\_posts目录下

然后重新push即可

但是我们每次写完之后再手动上传感觉好麻烦,我们这里可以使用Github Action自动部署hexo到GitHub pages

5、使用Github Action自动部署hexo到GitHub pages(我这里并没有整好,姑且按着大佬的实现了一下,一下内容仅供参考)

首先我们需要在github中创建一个私有库(创建方式同上述创建方式,只不过需要把public选为private)

创建好之后点击settings

创建仓库密钥

name一定要填EXO_DEPLOY_KEY,

之后还是需要我们再次去生成密钥,这次我们在hexo-text文件夹中生成密钥

ssh-keygen -t rsa -b 4096 -C "Hexo Deploy Key" -f github-deploy-key -N ""

之后在 Value 填入 github-deploy-key(私钥)  中的内容

粘贴进入add就行

之后配置公钥,把公钥放到我们的公共库中也是就username.github.io库中

name需要命名为HEXO_DEPLOY_PUB(可自定义)

之后把我们的公钥内容放进去即可

Allow write access 一定要勾上

add

之后再公共库中创建文件

.github/workflows/deploy.yml

文件内容(需要对里面的内容进行修改)

# Action 的名字
name: Hexo Auto Deployon:# 触发条件1:main 分支收到 push 后执行任务。push:branches:- main# 触发条件2:手动按钮workflow_dispatch:# 这里放环境变量,需要替换成你自己的
env:# Hexo 编译后使用此 git 用户部署到 github 仓库GIT_USER: username# Hexo 编译后使用此 git 邮箱部署到 github 仓库GIT_EMAIL: xxx@xxx.com# Hexo 编译后要部署的 github 仓库GIT_DEPLOY_REPO: username/username.github.io# Hexo 编译后要部署到的分支GIT_DEPLOY_BRANCH: main#  # Hexo 编译后使用此 gitee 用户部署到gitee仓库
#  GITEE_USER: wbsu2003
#  # Hexo 编译后要部署的 gitee 仓库
#  GITEE_DEPLOY_REPO: wbsu2003/wbsu2003
#  # Hexo 编译后要部署到的分支
#  GITEE_DEPLOY_BRANCH: master# 注意替换为你的 GitHub 源仓库地址GIT_SOURCE_REPO: git@github.com:dabing85/dabing85.github.io.git# 注意替换为你的 Gitee 目标仓库地址
#  GITEE_DESTINATION_REPO: git@gitee.com:wbsu2003/wbsu2003.gitjobs:build:name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }}runs-on: ubuntu-latestif: github.event.repository.owner.id == github.event.sender.idstrategy:matrix:os: [ubuntu-18.04]node_version: [12.x]steps:- name: Checkoutuses: actions/checkout@v2- name: Checkout deploy repouses: actions/checkout@v2with:repository: ${{ env.GIT_DEPLOY_REPO }}ref: ${{ env.GIT_DEPLOY_BRANCH }}path: .deploy_git- name: Use Node.js ${{ matrix.node_version }}uses: actions/setup-node@v1with:node-version: ${{ matrix.node_version }}- name: Configuration environmentenv:HEXO_DEPLOY_KEY: ${{secrets.HEXO_DEPLOY_KEY}}run: |sudo timedatectl set-timezone "Asia/Shanghai"mkdir -p ~/.ssh/echo "$HEXO_DEPLOY_KEY" > ~/.ssh/id_rsachmod 600 ~/.ssh/id_rsassh-keyscan -t rsa github.com >> ~/.ssh/known_hostsgit config --global user.name "$GIT_USER"git config --global user.email "$GIT_EMAIL"- name: Install dependenciesrun: |npm install hexo-cli -gnpm install# 根据你安装的组件进行安装
#          npm i hexo-renderer-multi-markdown-it --save
#          npm i hexo-autoprefixer --save
#          npm i  hexo-algolia --save
#          npm i hexo-algoliasearch --save
#          npm i hexo-symbols-count-time --save
#          npm i hexo-feed --save --egacy-peer-deps
#          hexo-deployer-git --save# 复制中文语言包,解决菜单英文的问题
#               cp zh-CN.yml node_modules/hexo-theme-next/languages/- name: Deploy hexorun: |hexo cleanhexo deploy# 以下为发布到gitee
#      - name: Sync to Gitee
#        uses: wearerequired/git-mirror-action@master
#        env:
#          # 直接使用了 HEXO_DEPLOY_PRI
#          SSH_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRI }}
#        with:
#          # GitHub 源仓库地址
#          source-repo: ${{ env.GIT_SOURCE_REPO }}
#          # Gitee 目标仓库地址
#          destination-repo: ${{ env.GITEE_DESTINATION_REPO }}#      - name: Build Gitee Pages
#        uses: yanglbme/gitee-pages-action@main
#        with:
#          # 你的 Gitee 用户名
#          gitee-username: ${{ env.GITEE_USER }}
#          # 注意在 Settings->Secrets 配置 GITEE_PASSWORD
#          gitee-password: ${{ secrets.GITEE_PASSWORD }}
#          # 你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
#          gitee-repo: ${{ env.GITEE_DEPLOY_REPO }}
#          # 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
#          branch: ${{ env.GITEE_DEPLOY_BRANCH }}

之后我们把我们的私有库git clone到本机上

然后把我们的hexo文件复制到刚刚clone的文件夹中,之后打开git输入一下命令

git init
git add
git commit -m 'the initial edition' //版本描述
git remote add origin https://github.com/用户名/仓库名.git 
git pull
git push -u origin maste 
git push origin master

之后我们就可以通过把md文章放到私有库中的对应位置就能实现自动上传了

遇到的问题

问题一,无法git push到github上

我这里有两种原因:

1、网速太垃圾,

解决办法:魔法上网

2、你的电脑上同时存在了多个github账号的ssh密钥

解决办法:

在.ssh目录下创建config文件进行配置

touch ~/.ssh/config

之后打开你的配置文件并复制一下内容

# Account 1
Host github.com-account1   //起个别名HostName github.comUser gitIdentityFile ~/.ssh/id_rsa_account1   //ssh文件1# Account 2
Host github.com-account2   //起个别名HostName github.comUser gitIdentityFile ~/.ssh/id_rsa_account2  //ssh文件2

之后使用命令进行测试,看看能不能链接成功

ssh -T git@github.com-mmjon
ssh -T git@github.com-KELYJ

成功!!!!

之后修改我的_config 为

deploy:type: gitrepo: git@github.com-KELYJ:KELYJ/KELYJ.github.io.gitbranch: main

重新拉取即可

问题二、图片无法正常显示

这里图片无法正常显示是因为官方图床的问题,在网上查到的有的说是新浪图床目前已经无法使用了 ,也有的说不是新浪图床,这里我也不没有查清到底是什么原因,反正总而言是就是图床坏了,这里我们修改掉这个图床就好了!!!!

首先我们需要找到/themes/shoka/scripts/helpers中的engine.js

之后我们找到第31行处,修改这个return后面的内容为

https://lz.sinaimg.cn/'+size+'/'+img

这里找到的是github上shoka主题官方问答模块中一个大佬分享的链接(这里直接跪谢大佬!!!▄█▀█●▄█▀█●▄█▀█●)

之后重新上传就可以解决这个问题了。

参考文章:

Hexo+shoka主题+github/服务器搭建个人博客-CSDN博客

利用GitHub Actions 自动部署 Hexo博客 全自动运行 不知所措的新哥 - 哔哩哔哩 (bilibili.com)

GitHub Actions 来自动部署 Hexo - 知乎 (zhihu.com)

Github配置ssh key的步骤(大白话+包含原理解释)_github生成ssh key-CSDN博客

Hexo 主题 Shoka & multi-markdown-it 渲染器使用说明 - Theme Shoka Documentation - 二进制杂谈 - 计算机科学 | Yume Shoka = 優萌初華 = 有夢書架 (lostyu.me)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/150460.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

睡眠监测系统基于边缘计算和微服务缓存

这篇论文的主要内容是关于基于边缘计算和微服务缓存的睡眠监测系统。以下是详细内容概述&#xff1a; 标题 睡眠监测系统基于边缘计算和微服务缓存 作者 Nico Surantha - 东京市立大学&#xff0c;日本David Jayaatmaja - 雅加达Bina Nusantara大学&#xff0c;印度尼西亚S…

Java面向对象(类和对象)(自己学习整理的资料)

目录 一.面向对象思想 二.类和对象 三&#xff1a;定义类的步骤 四.创建对象 五.用Java代码写一个简单的登录系统 练习 六.关于类的方法 七.类的无参无返回值方法 八.方法的返回值 练习 关于方法调用问题 九.全局变量和局部变量 十.笔记 一.面向对象思想 就只关注参…

FDA辅料数据库在线免费查询-药用辅料

在药物制剂的研制过程中&#xff0c;需要确定这些药用辅料的安全用量。而美国食品药品监督管理局&#xff08;FDA&#xff09;的辅料数据库&#xff08;IID&#xff09;提供了其制剂研发中的关键参考资源&#xff0c;使得更多的医药研发相关人员及企业单位节省试验环节及时间成…

快速学会一个算法,BERT

今天给大家介绍一个强大的算法模型&#xff0c;BERT BERT&#xff08;Bidirectional Encoder Representations from Transformers&#xff09;是一种基于 Transformer 架构的深度学习模型&#xff0c;主要用于处理自然语言处理&#xff08;NLP&#xff09;问题。 BERT 由 Goo…

星辰计划-深入理解kafka的消息存储和索引设计

消息存储 提到存储不得不说消息的读写&#xff0c;那么kafka他是如何读写数据的呢&#xff1f; 读取消息 1.通过debug(如何debug) 我们可以得到下面的调用栈&#xff0c;最终通过FileRecords来读取保存的数据 写入消息 1.通过debug(如何debug) 我们可以得到下面的调用栈&am…

模型django封装uvicorn服务器部署实战

Uvicorn 是一个轻量级的 ASGI 服务器&#xff0c;它基于 uvloop 和 httptools 这两个高性能的异步库。Uvicorn 提供了快速的启动时间和低延迟的响应&#xff0c;非常适合用于生产环境。 Django&#xff1a; 是一个开源且强大的Web框架&#xff0c;适用于快速开发和部署Python …

深度学习——线性回归

房价预测 线性模型 单层神经网络 损失函数的均方误差 训练数据 参数学习 显示解 偏导数少了负号 最优解y旁边的X少了转置符号 梯度下降 学习率选择 小批量随机梯度下降 批量规模的选择 总结

LeetCode 909. 蛇梯棋

LeetCode 909. 蛇梯棋 给你一个大小为 n x n 的整数矩阵 board &#xff0c;方格按从 1 到 n2 编号&#xff0c;编号遵循 转行交替方式 &#xff0c;从左下角开始 &#xff08;即&#xff0c;从 board[n - 1][0] 开始&#xff09;的每一行改变方向。 你一开始位于棋盘上的方格 …

Linux:八种重定向详解(万字长文警告)

相关阅读Linuxhttps://blog.csdn.net/weixin_45791458/category_12234591.html?spm1001.2014.3001.5482 本文将讨论Linux中的重定向相关问题&#xff0c;在阅读本文前&#xff0c;强烈建议先学习文件描述符的相关内容Linux&#xff1a;文件描述符详解。 重定向分为两类&#x…

个性化大语言模型:PPlug——让AI更懂你

在当今数字化转型的时代&#xff0c;大型语言模型&#xff08;LLMs&#xff09;已经成为了不可或缺的工具&#xff0c;它们在自然语言理解、生成和推理方面展现了非凡的能力。然而&#xff0c;这些模型普遍采用的是“一刀切”的方式&#xff0c;即对于相同的输入给予所有用户相…

MySQL的乐观锁、悲观锁机制及实现

乐观锁 乐观锁的实现参考了这篇文章&#xff0c;里面还将了乐观锁的时间戳实现方式&#xff1a; 跳转 概述 乐观锁是一种并发控制策略&#xff0c;它假设多个事务不会发生冲突&#xff0c;在执行操作时不加锁&#xff0c;非常乐观&#xff0c;只需每次进行提交时利用标识进行…

ansible批量安装postgresql软件

本文为杭州云贝教育 刘老师 原创&#xff0c;请尊重知识产权&#xff0c;转发请注明出处&#xff0c;不接受任何抄袭、演绎和未经注明出处的转载。 随着分布式系统和大规模应用的普及&#xff0c;自动化部署和管理变得越来越重要。Ansible 是一种流行的自动化工具&#xff0c;它…

DAY80服务攻防-中间件安全HW2023-WPS 分析WeblogicJettyJenkinsCVE

知识点 1、中间件-Jetty-CVE&信息泄漏 2、中间件-Jenkins-CVE&RCE执行 3、中间件-Weblogic-CVE&反序列化&RCE 4、应用WPS-HW2023-RCE&复现&上线CS 中间件-Jetty-CVE&信息泄漏 Jetty是一个开源的servlet容器&#xff0c;它为基于Java的Web容器…

分布式光伏监控系统 在鄂尔多斯市鄂托克旗某煤矿项目中的应用

摘 要&#xff1a;分布式光伏发电就是将太阳能光伏板分散布置在各个区域&#xff0c;通过小规模、模块化的方式实现电能的并网或独立使用&#xff0c;这种发电方式具有就近发电、就近并网、就近转换、就近使用的特点。近年来&#xff0c;技术和政策支持推动了光伏组件的成本持续…

sed(1):强大的文本处理命令

一、命令简介 ​sed​&#xff08;stream editor&#xff09;是一个强大的文本处理工具&#xff0c;它能够执行基本的文本转换&#xff0c;如替换、删除、插入和修改文本行的特定部分。sed​ 命令通常用于对文本文件进行批量编辑&#xff0c;也可以用于处理来自管道的输入。 …

煤矿井下钻场目标检测数据集 5类 voc格式

煤矿井下钻场目标检测数据集 本数据集包含了来自不同钻场和环境背景条件下的70948张图片&#xff0c;涵盖了夹持器、钻机卡盘、煤矿工人、矿井安全帽和钻杆等五类目标&#xff0c;并提供了PASCAL VOC格式的标注文件。 摘要 煤矿井下钻场打钻是解决瓦斯灾害、水害、隐蔽地质灾害…

9.24-k8s服务发布

Ingress 使用域名发布 K8S 服务 部署项目 一、先部署mariadb [rootk8s-master ~]# mkdir aaa [rootk8s-master ~]# cd aaa/ [rootk8s-master aaa]# # 先部署mariadb [rootk8s-master aaa]# # configmap [rootk8s-master aaa]# vim mariadb-configmap.yaml apiVersion: v1 ki…

灵当CRM multipleUpload.php 文件上传致RCE漏洞复现

0x01 产品描述&#xff1a; 灵当CRM是一款专为中小企业量身定制的智能客户关系管理工具&#xff0c;由上海灵当信息科技有限公司开发和运营。该系统广泛应用于多个行业&#xff0c;包括金融、教育、医疗、IT服务及房地产等领域&#xff0c;旨在满足企业对客户个性化管理的需求&…

使用yum为centos系统安装软件以及使用(包含阿里云yum源配置)

centos系统配置阿里云yum源 因为centos7官方停止维护&#xff0c;自带yum源用不了了&#xff0c;所以可以更换成阿里云yum源 方法&#xff1a; 使用root权限执行以下语句 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo CentOS…

【LinuxC高级】汇总

ls ls -l&#xff1a;显示文件的详细信息 ls -a&#xff1a;显示隐藏文件 ls -lh&#xff1a;文件大小单位显示 ls -i&#xff1a;显示文件的inode号 修改密码 passwd 用户名 su 用户名 -----> 用户名 su ----> 如果不加用户名&#xff0c;默认切换到超级用户 cd cd 路径…