Automate git deployment of hugo websites
How can I autmatically deploy my hugo website, if I push a new commit to my git repo?
Starting situation If you put your bare Git Repos to /srv/git/ and the websites to /srv/www/.
cd /srv mkdir -p git www git/website cd git/website git init –bare cd /srv/www/ git clone /srv/git/website website Create post-receive file To update another git repo from a post-receive hook, both variables GIT_WORK_TREE and GIT_DIR has to be set correctly.
Helpful git command line tricks
man gittutorial
git config Nun dürfen wir noch unseren Namen und unsere Email einstellen mit denen die Commits später gezeichnet werden ( /.gitconfig).
git config –global user.name "Vorname Nachname" git config –global user.email email@domain.tld Automatische E-Mails einrichten cd /path-to-bare-git-repo/.git/hooks ln -sf /usr/share/doc/git-core/contrib/hooks/post-receive-email post-receive chmod a+x /usr/share/doc/git-core/contrib/hooks/post-receive-email git-config hooks.mailinglist "to@example.org" Workflow cd ~/src git init oder
git clone ssh://alice@git.domain.tld:22/project project vi ~/.git/description vi test.txt git diff git add test.