赞
踩
1.安装node.js
2.安装git
3.申请GitHub账号
在开始菜单中打开git下的git bash(当然,在其他目录下打开git bash也是一样的),然后执行:
ls -al ~/.ssh
检测配置,执行:
git config user.name
git config user.email
如果之前没有创建,则执行以下命令:
git config –global user.name ‘xxxxx’
git config –global user.email ‘xxx@xx.xxx’
生成秘钥:
ssh-keygen -t rsa -C ‘上面的邮箱’
代码参数含义:
-t 指定密钥类型,默认是 rsa ,可以省略。
-C 设置注释文字,比如邮箱。
-f 指定密钥文件存储文件名。
如下图所示:
详细信息:
[root@localhost ~]# ssh-keygen -t rsa <== 建立密钥对,-t代表类型,有RSA和DSA两种 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): <==密钥文件默认存放位置,按Enter即可 Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): <== 输入密钥锁码,或直接按 Enter 留空 Enter same passphrase again: <== 再输入一遍密钥锁码 Your identification has been saved in /root/.ssh/id_rsa. <== 生成的私钥 Your public key has been saved in /root/.ssh/id_rsa.pub. <== 生成的公钥 The key fingerprint is: SHA256:K1qy928tkk1FUuzQtlZK+poeS67vIgPvHw9lQ+KNuZ4 root@localhost.localdomain The key's randomart image is: +---[RSA 2048]----+ | +. | | o * . | | . .O + | | . *. * | | S =+ | | . =... | | .oo =+o+ | | ==o+B*o. | | oo.=EXO. | +----[SHA256]-----+
(C盘用户文件夹下.ssh目录)得到了两个文件:id_rsa(私有秘钥)和id_rsa.pub(公有密钥)
在GitHub首页点击your repositories
点击New按钮,创建仓库
输入Repository name(仓库名称 )。**仓库名称为:用户名+.github.io **, 其他选择默认配置。点 击Create repository(创建仓库)
选择仓库的settings,点击Pages,查看仓库访问页
以hexo为例搭建博客:
npm install hexo-cli -g
hexo init blog
npm install
hexo server
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo:
github: https://github.com/用户名//用户名.github.io.git
# github: https://github.com/LemonMei/LemonMei.github.io.git
branch: main
npm install hexo-deployer-git --save
hexo g
生成Personal access tokens
点击Developer settings
点击生成Personal access tokens
任意输入Note,选择30天有效时间,下面全选,点击生成。
复制保存Personal access tokens
将博客项目上传至GitHub仓库
hexo d
输入用户名:
输入Personal access tokens
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。