網(wǎng)站建設(shè)ppt答辯/seo優(yōu)化包括什么
前言
在使用 hexo 搭建個(gè)人博客時(shí),共兩種部署的方法。分別為:
- 本地利用 hexo 的插件 hexo-deployer-git 來實(shí)現(xiàn)部署,缺點(diǎn)是需要多敲幾個(gè)命令行且不方便對源碼進(jìn)行云端備份
- 使用 Github Action 的 workflow 自動(dòng)化部署,優(yōu)勢就是可以在 push 備份源碼的同時(shí)自動(dòng)檢測行為并自動(dòng)構(gòu)建部署代碼
看似十分方便但是問題也出在這,我發(fā)現(xiàn)使用 Github Action 的 workflow 自動(dòng)化部署 的站點(diǎn)內(nèi)容與使用 hexo 插件部署的內(nèi)容不一致。由于不懂 yml 的構(gòu)建語法與邏輯以及關(guān)于 git 用戶授權(quán)等知識(shí),以至于我始終無法 debug 問題到底出在哪。最終決定放棄使用 Github Action,還是老老實(shí)實(shí)敲 hexo 的命令行,但是我還需要進(jìn)行筆記的源碼備份,故還需要在 push 到云端。
為了盡可能的簡化命令行,我嘗試進(jìn)行 git 命令的宏定義。查詢一番后發(fā)現(xiàn)確實(shí)可以,故有了本篇博客,下面開始介紹如何進(jìn)行 git 的命令的宏定義:
宏定義
操作系統(tǒng)為 Windows OS 11
我們進(jìn)入 Git 軟件的安裝目錄,我的是 D:\installation_package\Git
,然后進(jìn)入 etc\profile.d
并編輯 aliases.sh
文件,默認(rèn)內(nèi)容為:
# Some good standards, which are not used if the user
# creates his/her own .bashrc/.bash_profile# --show-control-chars: help showing Korean or accented characters
alias ls='ls -F --color=auto --show-control-chars'
alias ll='ls -l'case "$TERM" in
xterm*)# The following programs are known to require a Win32 Console# for interactive usage, therefore let's launch them through winpty# when run inside `mintty`.for name in node ipython php php5 psql python2.7 wingetdocase "$(type -p "$name".exe 2>/dev/null)" in''|/usr/bin/*) continue;;esacalias $name="winpty $name.exe"done;;
esac
我們向 alias 中添加一行自定義的宏定義:alias gph='git push && hexo clean && hexo g && hexo d'
,就可以實(shí)現(xiàn)在 push 的同時(shí)使用 hexo 的部署插件進(jìn)行部署了!