git

Enable git over ssh

Have you ever watched video where developer securely clone their git repos without entering a password and wondered how to set that up? Well, it’s quite simple and I’ll walk you through the steps. This approach uses ssh keys to authenticate and then the sync occurs over ssh tunnels, encrypting the traffic. Setting up ssh keys is simple and you’ll no longer have to type in a username and password.

Diff for git submodules

If you are leveraging git submodule for Hugo themes and you are accustomed to using git diff to see what changes you made and totally forgot to commit, you will need to tweak your command for git submodules. By appending --submodule=diff you will see diffs for submodules as well: $ git diff --submodule=diff You can run this command at your top level repo and see all changes in that repo plus submodule(s) or cd into a specific submodule and see see the diffs for those changes only.

Configure git submodule for no password (ssh)

If you are leveraging git submodule for Hugo themes and you are accustomed to using git without passwords (via ssh urls), you’ll find that when you add a git submodule, it will be setup for “https urls” and thus prompt you for a password: $ git push origin master Username for 'https://github.com': This is obviously annoying but easy to fix. You can check the urls for your origin with git remote -v:

Using git submodule for Hugo themes

When I first started tinkering with Hugo for static website generation, I would find a Hugo theme that I like, cd into my themes directory and would simply git clone the repo into my website. This works, makes sense and is the most common install instructions from the theme authors. However, you will likely run into an issue where you want to make an edit to the theme only for your website.