prerequists

PS C:\> get-command ssh

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     ssh.exe                                            8.1.0.1    C:\WINDOWS\System32\OpenSSH\ssh.exe

ssh のPrivate KeyやPortを指定する場合は、~/.ssh/config に定義しておく。

remote

mkdir -p ~/dev/example.host.git
cd ~/dev/example.host.git
git init --bare --share

cd
git clone /home/user/dev/example.host.git public_html

上記例は public_html が公開ディレクトリの場合。

dev/sites/example.host.git/hooks/post-receive にフックを作成。

#!/bin/sh
TARGET_DIR=/home/user/public_html
cd $TARGET_DIR
git --git-dir=$TARGET_DIR/.git pull

local

hugo で生成されたファイルは public フォルダ内に存在する。

cd public
git init
git add -A

git remote add origin ssh://example.host/home/user/dev/example.host.git
git remote -v
git push origin master

add contents and push

# 追加
hugo new posts/test.md
# 編集
code posts/test.md
# 生成
hugo
# deploy
cd public
git add .
git commit -m "comment"
git push origin master