1
0
mirror of https://github.com/StarGazer114/stargazer114.github.io.git synced 2025-01-08 14:28:17 +08:00
stargazer114.github.io/0bb772f89466/index.html

350 lines
44 KiB
HTML
Raw Permalink Normal View History

2025-01-05 20:41:38 +08:00
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>部署hexo博客 | 拾光小阁</title><meta name="author" content="br"><meta name="copyright" content="br"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Hexo 是一个快速、简洁且高效的博客框架。 Hexo 使用 Markdown或其他标记语言解析文章在几秒内即可利用靓丽的主题生成静态网页。 安装hexo可以参照官方文档安装.">
<meta property="og:type" content="article">
<meta property="og:title" content="部署hexo博客">
<meta property="og:url" content="https://bear556.top/0bb772f89466/index.html">
<meta property="og:site_name" content="拾光小阁">
<meta property="og:description" content="Hexo 是一个快速、简洁且高效的博客框架。 Hexo 使用 Markdown或其他标记语言解析文章在几秒内即可利用靓丽的主题生成静态网页。 安装hexo可以参照官方文档安装.">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cn-sy1.rains3.com/img-bed/2024/12/22/67678485ddfc5.jpeg">
<meta property="article:published_time" content="2024-09-11T04:56:32.000Z">
<meta property="article:modified_time" content="2024-12-16T07:08:00.476Z">
<meta property="article:author" content="br">
<meta property="article:tag" content="Github">
<meta property="article:tag" content="hexo">
<meta property="article:tag" content="netlify">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cn-sy1.rains3.com/img-bed/2024/12/22/67678485ddfc5.jpeg"><link rel="shortcut icon" href="/img/favicon.ico"><link rel="canonical" href="https://bear556.top/0bb772f89466/index.html"><link rel="preconnect"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="/pluginsSrc/@fortawesome/fontawesome-free/css/all.min.css"><script>
(() => {
const saveToLocal = {
set: (key, value, ttl) => {
if (!ttl) return
const expiry = Date.now() + ttl * 86400000
localStorage.setItem(key, JSON.stringify({ value, expiry }))
},
get: key => {
const itemStr = localStorage.getItem(key)
if (!itemStr) return undefined
const { value, expiry } = JSON.parse(itemStr)
if (Date.now() > expiry) {
localStorage.removeItem(key)
return undefined
}
return value
}
}
window.btf = {
saveToLocal,
getScript: (url, attr = {}) => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
script.onload = script.onreadystatechange = () => {
if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
}
script.onerror = reject
document.head.appendChild(script)
}),
getCSS: (url, id) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onload = link.onreadystatechange = () => {
if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
}
link.onerror = reject
document.head.appendChild(link)
}),
addGlobalFn: (key, fn, name = false, parent = window) => {
if (!true && key.startsWith('pjax')) return
const globalFn = parent.globalFn || {}
globalFn[key] = globalFn[key] || {}
globalFn[key][name || Object.keys(globalFn[key]).length] = fn
parent.globalFn = globalFn
}
}
const activateDarkMode = () => {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
const activateLightMode = () => {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
btf.activateDarkMode = activateDarkMode
btf.activateLightMode = activateLightMode
const theme = saveToLocal.get('theme')
theme === 'dark' ? activateDarkMode() : theme === 'light' ? activateLightMode() : null
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
}
const detectApple = () => {
if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
document.documentElement.classList.add('apple')
}
}
detectApple()
})()
</script><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":true,"languages":{"hits_empty":"未找到符合您查询的内容:${query}","hits_stats":"共找到 ${hits} 篇文章"}},
translate: undefined,
highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":false},
copy: {
success: '复制成功',
error: '复制失败',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
post: false
},
runtime: '',
dateSuffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'null',
Snackbar: undefined,
infinitegrid: {
js: '/pluginsSrc/@egjs/infinitegrid/dist/infinitegrid.min.js',
buttonText: '加载更多'
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: false,
},
autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: '部署hexo博客',
isPost: true,
isHome: false,
isHighlightShrink: false,
isToc: true,
isShuoshuo: false
}</script><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@700&display=swap" rel="stylesheet"><meta name="generator" content="Hexo 7.3.0"><link rel="alternate" href="/rss.xml" title="拾光小阁" type="application/rss+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>(()=>{
const $loadingBox = document.getElementById('loading-box')
const $body = document.body
const preloader = {
endLoading: () => {
$body.style.overflow = ''
$loadingBox.classList.add('loaded')
},
initLoading: () => {
$body.style.overflow = 'hidden'
$loadingBox.classList.remove('loaded')
}
}
preloader.initLoading()
window.addEventListener('load', preloader.endLoading)
if (true) {
btf.addGlobalFn('pjaxSend', preloader.initLoading, 'preloader_init')
btf.addGlobalFn('pjaxComplete', preloader.endLoading, 'preloader_end')
}
})()</script><div id="web_bg" style="background-image: url(https://cn-sy1.rains3.com/static-1/img/DFeeiOJQRFYUUFbBQM.webp);"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img text-center"><img src="/img/avatar.webp" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data text-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">14</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">11</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/talks/"><i class="fa-fw fas fa-comment"></i><span> 叨叨</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fas fa-list"></i><span> 镜像</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="https://bear556.top"><span> 主站</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://gh.bear556.top"><span> Github</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://blog.bear556.top"><span> Netlify</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://vc.bear556.top"><span> Vercel</span></a></li></ul></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://www.travellings.cn/go.html"><i class="fa-fw fas fa-subway"></i><span> 开往</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://cn-sy1.rains3.com/img-bed/2024/12/22/67678485ddfc5.jpeg);"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><span class="site-name">拾光小阁</span></a><a class="nav-page-title" href="/"><span class="site-name">部署hexo博客</span></a></span><div id="menus"><div id="search-button"><span class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></span></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/talks/"><i class="fa-fw fas fa-comment"></i><span> 叨叨</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fas fa-list"></i><span> 镜像</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="https://bear556.top"><span> 主站</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://gh.bear556.top"><span> Github</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://blog.bear556.top"><span> Netlify</span></a></li><li><a class="site-page child" tar
<h2 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h2><p>可以参照<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">官方文档</a>安装.<span id="more"></span></p>
<h3 id="一键部署脚本"><a href="#一键部署脚本" class="headerlink" title="一键部署脚本"></a>一键部署脚本</h3><p>如果你实在看不懂安装文档我这里写了一个一键安装脚本用于安装npm和hexo适用于Ubuntu系统使用前请确保你的电脑上没有安装nodejs使用<code>node -v</code><code>npm -v</code>来查看,如果提示<code>bash: npm: command not found</code>,即可使用这个脚本,成功运行后可以直接到<code>~/blog</code>目录下查看</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -O https://raw.githubusercontent.com/lijiashuai111/hexo-auto-install/main/hexo-auto-install.sh &amp;&amp; sh hexo-auto-install.sh</span><br></pre></td></tr></table></figure>
<h2 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a>配置文件</h2><p>Hexo的配置文件 <code>_config.yml</code> 包含了多个关键配置项,每个都具有特定的功能:</p>
<ol>
<li><strong>title</strong>: 设置博客的标题。</li>
<li><strong>subtitle</strong>: 设置博客的副标题。</li>
<li><strong>description</strong>: 描述博客的内容。</li>
<li><strong>author</strong>: 博客的作者名字。</li>
<li><strong>language</strong>: 设置博客使用的语言。</li>
<li><strong>timezone</strong>: 设定博客的时区。</li>
<li><strong>url</strong>: 博客的网址。</li>
<li><strong>root</strong>: 网站根目录的路径。</li>
<li><strong>permalink</strong>: 文章的永久链接格式。</li>
<li><strong>permalink_defaults</strong>: 设置永久链接中各个部分的默认值。</li>
</ol>
<p>还有很多其他的配置项涉及到主题、部署、插件等,详细的说明可以在<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration">Hexo 的配置文档</a>中找到。</p>
<h2 id="开始写作"><a href="#开始写作" class="headerlink" title="开始写作"></a>开始写作</h2><p>使用<code>hexo n &lt;文章名&gt;</code>来新建一个文章,默认文章存储在<code>source/_posts/文章名.md</code>编辑它,开始你的写作,你可以使用<code>hexo s</code>来在本地4000端口下启动一个开发服务器他可以实时响应你的更改。</p>
<h2 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h2><p>写完文章后你可以使用<code>hexo g</code>来生成静态文件,生成完毕之后会存储在<code>/public</code>目录下,你可以把整个目录上传到你的服务器上或者静态网站托管服务上</p>
<h3 id="部署到GitHubpages"><a href="#部署到GitHubpages" class="headerlink" title="部署到GitHubpages"></a>部署到GitHubpages</h3><p>你可以把博客托管到GitHubpages</p>
<h4 id="创建建ssh密钥"><a href="#创建建ssh密钥" class="headerlink" title="创建建ssh密钥"></a>创建建ssh密钥</h4><p>创建ssh密钥用于连接到GitHub</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C <span class="string">&quot;你的 GitHub 邮箱&quot;</span></span><br></pre></td></tr></table></figure>
<p>获取公钥内容复制并填写到GitHub上</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> &amp;&amp; <span class="built_in">cat</span> .ssh/id_rsa.pub</span><br></pre></td></tr></table></figure>
<p>前往[<a target="_blank" rel="noopener" href="https://github.com/settings/keys]">https://github.com/settings/keys]</a> ,点击<code>New SSH key</code>,填写刚刚复制的公钥内容,然后回到终端,输入<code>ssh git@github.com</code>如果出现了你的用户名代表成功</p>
<hr>
<p>新建一个仓库,命名为&lt;用户名&gt;.github.io</p>
<h4 id="安装插件"><a href="#安装插件" class="headerlink" title="安装插件"></a>安装插件</h4><p>在终端输入<code>npm install hexo-deployer-git --save</code>,然后编辑<code>_config.yml</code>,添加以下内容:</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line"> <span class="attr">repo:</span> <span class="string">&lt;仓库的ssh地址&gt;</span></span><br><span class="line"> <span class="attr">branch:</span> <span class="string">main</span></span><br></pre></td></tr></table></figure>
<p>仓库的ssh地址在仓库主页中间绿色的code-ssh即可复制</p>
<h4 id="推送"><a href="#推送" class="headerlink" title="推送"></a>推送</h4><p>然后使用以下命令来部署博客:</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo g <span class="comment">## 生成静态文件</span></span><br><span class="line">hexo d <span class="comment">## 将静态文件推送到GitHub</span></span><br></pre></td></tr></table></figure>
<p>然后访问&lt;用户名&gt;.github.io就可以看到你的网站了。</p>
<h3 id="部署到Netlify"><a href="#部署到Netlify" class="headerlink" title="部署到Netlify"></a>部署到Netlify</h3><p>Netlify 是一个提供静态资源网络托管的综合平台提供CI服务能够将托管 GitHubGitLab 等网站上的 JekyllHexoHugo 等代码自动编译并生成静态网站。<br>本站就是在Netlify上托管的</p>
<h4 id="如何使用"><a href="#如何使用" class="headerlink" title="如何使用"></a>如何使用</h4><p>首先注册账号[<a target="_blank" rel="noopener" href="https://app.netlify.com/]">https://app.netlify.com/]</a><br>点击添加站点-导入现有项目(浏览器翻译)<br><img src="https://img.bear556.top/uplodas/2024/10/02/66fd013a9c55d.png" alt="1727856956622.png"><br>登录你的GitHub账户选择你的<strong>hexo自动部署仓库</strong>(博客源码),部署命令填写<code>hexo g</code>,发布目录填写<code>public</code><br><img src="https://img.bear556.top/uplodas/2024/10/02/66fd015814f53.png" alt="1727856986059.png"><br>点击部署<br>部署完成后就可以在主页找到访问地址,你也可以添加自己的域名来访问<br><img src="https://img.bear556.top/uplodas/2024/10/02/66fd016373698.png" alt="1727856997484.png"></p>
<h4 id="Netlify和GitHubPages的对比"><a href="#Netlify和GitHubPages的对比" class="headerlink" title="Netlify和GitHubPages的对比"></a>Netlify和GitHubPages的对比</h4><p>优点:</p>
<ul>
<li>有免费的cdn国内访问速度快</li>
<li>可以自动申请ssl证书无需操心</li>
<li>部署速度也比较快</li>
</ul>
<p>缺点:</p>
<ul>
<li>限额免费帐户每个月只有100G免费流量300分钟构建时间对于访问量小的博客十分足够也可以算作优点</li>
</ul>
<h3 id="ftp部署"><a href="#ftp部署" class="headerlink" title="ftp部署"></a>ftp部署</h3><p>ftp部署适用于部署到虚拟主机网站空间等可以通过ftp把静态文件上传到网站空间。<br>安装<code>hexo-deployer-ftpsync</code></p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-ftpsync --save</span><br></pre></td></tr></table></figure>
<p>在hexo配置文件<code>_config.yml</code>下添加如下配置:</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">ftpsync</span></span><br><span class="line"> <span class="attr">host:</span> <span class="comment">#ftp服务器地址</span></span><br><span class="line"> <span class="attr">user:</span> <span class="comment">#ftp用户名</span></span><br><span class="line"> <span class="attr">pass:</span> <span class="comment">#ftp用户密码</span></span><br><span class="line"> <span class="attr">remote:</span> <span class="comment">#远程路径</span></span><br><span class="line"> <span class="attr">port:</span> <span class="comment">#ftp端口默认为21</span></span><br><span class="line"> <span class="attr">clear:</span> <span class="literal">true</span> <span class="comment">#部署时是否清除远程路径下的所有文件</span></span><br><span class="line"> <span class="attr">verbose:</span> <span class="literal">true</span> <span class="comment">#是否输出日志</span></span><br></pre></td></tr></table></figure>
<h2 id="同时配置多个部署"><a href="#同时配置多个部署" class="headerlink" title="同时配置多个部署"></a>同时配置多个部署</h2><p>见下</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"> <span class="string">-type:</span> <span class="string">git</span></span><br><span class="line"> <span class="attr">repo:</span> <span class="string">&lt;仓库的ssh地址&gt;</span></span><br><span class="line"> <span class="attr">branch:</span> <span class="string">main</span></span><br><span class="line"> <span class="string">-type:</span> <span class="string">ftpsync</span></span><br><span class="line"> <span class="attr">host:</span> <span class="comment">#ftp服务器地址</span></span><br><span class="line"> <span class="attr">user:</span> <span class="comment">#ftp用户名</span></span><br><span class="line"> <span class="attr">pass:</span> <span class="comment">#ftp用户密码</span></span><br><span class="line"> <span class="attr">remote:</span> <span class="comment">#远程路径</span></span><br><span class="line"> <span class="attr">port:</span> <span class="comment">#ftp端口默认为21</span></span><br><span class="line"> <span class="attr">clear:</span> <span class="literal">true</span> <span class="comment">#部署时是否清除远程路径下的所有文件</span></span><br><span class="line"> <span class="attr">verbose:</span> <span class="literal">true</span> <span class="comment">#是否输出日志</span></span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://bear556.top">br</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://bear556.top/0bb772f89466/">https://bear556.top/0bb772f89466/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://bear556.top" target="_blank">拾光小阁</a></span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Github/">Github</a><a class="post-meta__tags" href="/tags/hexo/">hexo</a><a class="post-meta__tags" href="/tags/netlify/">netlify</a></div><div class="post-share"><div class="social-share" data-image="https://cn-sy1.rains3.com/img-bed/2024/12/22/67678485ddfc5.jpeg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="/pluginsSrc/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="/pluginsSrc/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><a class="pagination-related" href="/58256fdefc6c/" title="使用ssh连接git服务"><img class="cover" src="https://t.mwm.moe/fj" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="info"><div class="info-1"><div class="info-item-1">上一篇</div><div class="info-item-2">使用ssh连接git服务</div></div><div class="info-2"><div class="info-item-1">生成密钥ssh-keygen -t rsa -C &quot;你的邮箱&quot;,然后一路回车,前往~/.ssh目录下查看密钥打开id_rsa.pub文件复制下来前往[https://github.com/settings/keys]点击New ssh key填写你刚刚复制的公钥内容完成 测试连接ssh进行测试 1ssh git@github.com 返回结果 123PTY allocation request failed on channel 0Hi lijiashuai111! You&#x27;ve successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed. 完成你现在可以使用ssh来进行克隆拉取等操作了 </div></div></div></a><a class="pagination-related" href="/6f8924fabaa8/" title="🎉【教师节快乐】🎉"><div class="cover" style="background: var(--default-bg-color)"></div><div class="info text-right"><div class="info-1"><div class="info-item-1">下一篇</div><div class="info-item-2">🎉【教师节快乐】🎉</div></div><div class="info-2"><div class="info-item-1"> 感谢老师们的辛勤付出( </div></div></div></a></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><a class="pagination-related" href="/c309a01be576/" title="使用docsify+GitHubPages搭建静态文档站"><img class="cover" src="https://t.mwm.moe/fj" alt="cover"><div class="info text-center"><div class="info-1"><div class="info-item-1"><i class="far fa-calendar-alt fa-fw"></i> 2024-08-25</div><div class="info-item-2">使用docsify+GitHubPages搭建静态文档站</div></div><div class="info-2"><div class="info-item-1">我建的站:赛博扫盲手册 安装docsify1234npm i docsify-cli -g # 安装docsifydocsify init ./docs # 初始化并创建./docs文件夹 安装成功了,可以看到对应目录下出现了这些文件: index.html 入口文件 README.md 会做为主页内容渲染 .nojekyll 用于阻止 GitHub Pages 忽略掉下划线开头的文件 现在就可以编辑README.md来修改主页内容了你也可以使用docsify serve ./docs来在本机300
let initFn = window.walineFn || null
const isShuoshuo = GLOBAL_CONFIG_SITE.isShuoshuo
const option = null
const destroyWaline = ele => ele.destroy()
const initWaline = (Fn, el = document, path = window.location.pathname) => {
const waline = Fn({
el: el.querySelector('#waline-wrap'),
serverURL: 'https://waline.bear556.top',
pageview: true,
dark: 'html[data-theme="dark"]',
comment: false,
...option,
path: isShuoshuo ? path : (option && option.path) || path
})
if (isShuoshuo) {
window.shuoshuoComment.destroyWaline = () => {
destroyWaline(waline)
if (el.children.length) {
el.innerHTML = ''
el.classList.add('no-comment')
}
}
}
}
const loadWaline = (el, path) => {
if (initFn) initWaline(initFn, el, path)
else {
btf.getCSS('/pluginsSrc/@waline/client/dist/waline.css')
.then(() => import('/pluginsSrc/@waline/client/dist/waline.js'))
.then(({ init }) => {
initFn = init || Waline.init
initWaline(initFn, el, path)
window.walineFn = initFn
})
}
}
if (isShuoshuo) {
'Waline' === 'Waline'
? window.shuoshuoComment = { loadComment: loadWaline }
: window.loadOtherComment = loadWaline
return
}
if ('Waline' === 'Waline' || !false) {
if (false) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
window.loadOtherComment = loadWaline
}
})()</script></div><div class="aplayer no-destroy" data-id="9401784769" data-server="tencent" data-type="playlist" data-fixed="true" data-autoplay="true"> </div><script defer="defer" id="fluttering_ribbon" mobile="false" src="/pluginsSrc/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><link rel="stylesheet" href="/pluginsSrc/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="/pluginsSrc/aplayer/dist/APlayer.min.js"></script><script src="/pluginsSrc/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script>(() => {
const destroyAplayer = () => {
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
}
const runMetingJS = () => {
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
}
btf.addGlobalFn('pjaxSend', destroyAplayer, 'destroyAplayer')
btf.addGlobalFn('pjaxComplete', loadMeting, 'runMetingJS')
})()</script><script src="/pluginsSrc/pjax/pjax.min.js"></script><script>(() => {
const pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]
window.pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
const triggerPjaxFn = (val) => {
if (!val) return
Object.values(val).forEach(fn => fn())
}
document.addEventListener('pjax:send', () => {
// removeEventListener
btf.removeGlobalFnEvent('pjaxSendOnce')
btf.removeGlobalFnEvent('themeChange')
// reset readmode
const $bodyClassList = document.body.classList
if ($bodyClassList.contains('read-mode')) $bodyClassList.remove('read-mode')
triggerPjaxFn(window.globalFn.pjaxSend)
})
document.addEventListener('pjax:complete', () => {
btf.removeGlobalFnEvent('pjaxCompleteOnce')
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
triggerPjaxFn(window.globalFn.pjaxComplete)
})
document.addEventListener('pjax:error', e => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})
})()</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="text-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span> 数据加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜搜搜~" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div></body></html>