(5)hexo new myblog 或 hex n myblog 在默认路径source\_posts下生成一篇标题名为myblog的文章,进入该目录,打开myblog.md编辑书写文章 C:\Users\admin>cd hexo C:\Users\admin\hexo>hexo n myblog INFO Validating config INFO Created: ~\hexo\source\_posts\myblog.md
(6)删除文件 在source/_posts文件夹中手工删除不需要的目录或文件,然后执行hexe clean. hexo g hexo s更新记录
(7)批量执行启动或部署命令 hexo clean && hexo g & hexo s hexo clean && hexo g & hexo d
(3)push文件至远程仓库,报错的处理方法 C:\Users\admin\hexo>git init Initialized empty Git repository in C:/Users/admin/hexo/.git/
C:\Users\admin\hexo>git add .
C:\Users\admin\hexo>git commit -m "hexo"
C:\Users\admin\hexo>git push -u origin main error: src refspec main does not match any error: failed to push some refs to 'github.com:soxo/soxo.github.io.git'
C:\Users\admin\hexo>git push -u origin main To soxo.github.com:soxo/soxo.github.io.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'soxo.github.com:soxo/soxo.github.io.git' hint: Updates were rejected because the remote contains work that you do not hint: have locally. This is usually caused by another repository pushing to hint: the same ref. If you want to integrate the remote changes, use hint: 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
C:\Users\admin\hexo>git branch -r origin/main C:\Users\admin\hexo>git push origin --delete main To soxo.github.com:soxo/soxo.github.io.git - [deleted] main
C:\Users\admin\hexo>git branch -r
C:\Users\admin\hexo>git branch * main
C:\Users\admin\hexo>git push -u origin main Enumerating objects: 76, done. Counting objects: 100% (76/76), done. Delta compression using up to 16 threads Compressing objects: 100% (62/62), done. Writing objects: 100% (76/76), 107.82 KiB | 322.00 KiB/s, done. Total 76 (delta 8), reused 44 (delta 1), pack-reused 0 (from 0) remote: Resolving deltas: 100% (8/8), done. remote: remote: Create a pull request for 'main' on GitHub by visiting: remote: https://github.com/soxo/soxo.github.io/pull/new/main remote: To soxo.github.com:soxo/soxo.github.io.git * [new branch] main -> main branch 'main' set up to track 'origin/main'.
C:\Users\admin\hexo>git push origin --delete gh-pages error: unable to delete 'gh-pages': remote ref does not exist error: failed to push some refs to 'github.com:hexohub/hexohub.github.io.
remote ref does not exist这个错误提示说明远程分支已删除,git branch -av还能看到,是因为git fetch保存到本地的缓存信息还在。
C:\Users\admin\hexo>git push -u origin main branch 'main' set up to track 'origin/main'. Everything up-to-date
C:\Users\admin\hexo>git add .
C:\Users\admin\hexo>git commit -m "hexo"
C:\Users\admin\hexo>git push -u origin main
# 显示每个远程分支的引用信息 C:\Users\admin\hexo>git ls-remote From git@soxo.github.com:soxo/soxo.github.io.git 40eb5e1b5ec11f878c823dc4806efad4c68730bd HEAD 40eb5e1b5ec11f878c823dc4806efad4c68730bd refs/heads/gp-pages 03ed3de1172965883adc6e612a0c6aeb70eadf61 refs/heads/main
# 显示远程仓库的详细信息 C:\Users\admin\hexo>git remote show origin * remote origin Fetch URL: git@soxo.github.com:soxo/soxo.github.io.git Push URL: git@soxo.github.com:soxo/soxo.github.io.git HEAD branch: gp-pages Remote branches: gp-pages new (next fetch will store in remotes/origin) main tracked Local branch configured for 'git pull': main merges with remote main Local ref configured for 'git push': main pushes to main (up to date)
(7)删除示例 C:\Users\admin\hexo>git branch -a * gh-pages main remotes/origin/main
# 删除分区前,需切换当前分区到主分区 C:\Users\admin\hexo>git checkout main M _config.yml M source/_posts/python/python3-installation.md M source/_posts/script/hexo-deploy-github.md M source/css/custom_style.css D themes/tomotoes Switched to branch 'main'
C:\Users\admin\hexo>git branch -a gh-pages * main remotes/origin/main
Generating public/private rsa key pair. Enter file in which to save the key (C:\Users\admin/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:\Users\admin/.ssh/id_rsa Your public key has been saved in C:\Users\admin/.ssh/id_rsa.pub The key fingerprint is: SHA256:MwQ8HrLBd4hnXtpeFPmiqcvVAR7YWqWwg0Z3K98ynrg admin@DESKTOP-JJN2EOG The key's randomart image is: +---[RSA 3072]----+ | ..o+.. oo | | .=oOBo+o | | oX=BO. . | | .. +O.+o . | | ..S+o. | | o+B . | | ..+ . | | ..o | | E. | +----[SHA256]-----+
C:\Users\admin>cd .ssh
C:\Users\admin\.ssh>dir Volume in drive C has no label. Volume Serial Number is 70E6-2E1B