1、在文件夹初始化hexo
1 2
| hexo init blog //使用管理员权限打开cmd
|
尽量保持与GitHub上仓库名一致
2、npm换源,并且在创建的blog目录中安装 hexo-deployer-git –save
1 2 3 4
| //使用管理员权限打开cmd,不然安装会报错 npm config set registry https://registry.npmmirror.com/ npm i npm install hexo-deployer-git --save
|
3、在生成的blog文件夹中右键打开git bash,同时git bash生成ssh密钥导入GitHub,通过bash连接GitHub个人网站
(输入密码,如上个文档所输入123456后回车)
4、hexo博客配置文件_config.yml
修改成自己GitHub上创建项目的源
1 2 3 4
| deploy: type: git repository: https://github.com/823610177/blog.git branch: main
|
修改 站点信息
1 2 3 4 5 6 7
| title: Lanhy的个人博客 subtitle: '' description: '记录生活中想记录的事情' keywords: author: Lanhy language: zh-CN timezone: 'Asia/Shanghai'
|
5、改主体与添加文件及上传
(1)、git 初始化后,把master 改成Main
1 2
| git init git branch -M main
|
(2)、上传数据
1 2 3 4 5 6 7 8
| git commit -m "first commit" //代入首次上传数据的命令
git add . //上传添加当前文件夹所有文件
git push -u origin main //上传至Github的Main分支
|
6、看看github刷新文件没有