倒腾Pelican - Auto-publish shell script for pelican blog
First time configuration
For the first time commit to you github, you need a local git configuration.
Use the commandline:
$ git config --global user.name "your name"
$ git config --global user.email johndoe@example.com
you can see your global config. using:
$ git config --list
user.name=your name
user.email=johndoe@example.com
if use the --global
option, the information above will be stored in ~/.gitconfig
More about git configuration
And git document,download provided for 中文版 and English version.
Update blog
Our script named update
, put under ~/blog/
, i.e. your blog root path
Content of update
:
#cp -v ./setting.py content/extra/setting.py # unnecessary
make html
cd output
echo "git init " ; git init
echo "git add . " ; git add .
#git remote add origin https://github.com/jihenghu/jihenghu.io #uncomment this for the first pulish
echo "git commit" ; git commit -m $1
echo "git pull " ; git pull origin master
echo "git push " ; git push origin master
Use command line :
~/blog$ chmod +x update
~/blog$ ./update "comment to be attached to "git commit -m""
Example:
Shell script:
Cmd out:
For more about the order of git commit
and git pull
click here
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment