win10 本地搭建 docusaurus博客发布github上面

一、安装git

下载地址:Git - Downloading Package

安装完成后生成秘钥之后上车github上面实现本地免秘钥发布项目

git config --global user.name "github用户名"

git config --global user.email "github邮箱"

ssh-keygen -t rsa -C "[email protected]"    # 一路回车下去会在/c/Users/Administrator/.ssh/id_rsa.pub生成公钥 ,之后使用记事本打开复制公钥内容到github上面。

二、安装nodejs

下载地址:https://nodejs.org/dist/v16.14.2/node-v16.14.2-x86.msi

三 、github注册/登录

点击settings-->SSH and GPG keys--->  New ssh key ,复制公钥进去

四、创建github 项目

点击Creating repository 会创建一个项目

五、安装docusaurus到本地 

npx create-docusaurus@latest website classic    

 项目结构

my-website
├── blog
│   ├── 2019-05-28-hola.md
│   ├── 2019-05-29-hello-world.md
│   └── 2020-05-30-welcome.md
├── docs
│   ├── doc1.md
│   ├── doc2.md
│   ├── doc3.md
│   └── mdx.md
├── src
│   ├── css
│   │   └── custom.css
│   └── pages
│       ├── styles.module.css
│       └── index.js
├── static
│   └── img
├── docusaurus.config.js
├── package.json
├── README.md
├── sidebars.js
└── yarn.lock

运行 docusaurus,默认情况下,浏览器将自动打开 http://localhost:3000 的新窗口。

cd my-website
npm run start

六、项目不是github上面

git init
git add .
git remote add origin [email protected]:system/system.git
git commit -m "first commit"
git branch -M main
git push -u origin main
GIT_USER=system yarn deploy

之后访问github主目录文件即可打开个人博客

猜你喜欢

转载自blog.csdn.net/scxiaotan1/article/details/123891049
今日推荐