RSS Amplifier

BurgeonLab: Full-text · Jan 29, 2026

How I Blog with Hugo on Android with Termux (CLI Emulator)

0
Sign in to vote or save

Naty S · BurgeonLab

See how I enhanced my Hugo blogging workflow with Termux on Android: run a Hugo server locally, manage Git with Termux instead of relying on a separate Git client app (like PuppyGit or GitSync), resolve a fatal Hugo image processing error causing server to fail, learn to set up everything from scratch. I also share my portable computing setup.

Introduction

In the past, I mentioned how I use Hugo on different devices (Android and Linux). This week I made a significant upgrade on how I use Hugo on Android. Instead of having only basic access to my Hugo blog for drafting content; I can now run hugo server locally on my phone and easily see the changes I make to template or layout files. This is made possible by using a powerful Android app called Termux (a terminal emulator + Linux environment app).

I have heard of Termux for a few years, but never got round to trying it. It is really amazing having a CLI in your pocket! I have installed hugo, git, wget, dart-sass packages to get Hugo working. I’m sure there are many more packages to try, but that’s for another day.

Termux Hugo Workflow

With a proper terminal interface, Hugo and Git commands can be run instead of using a Git client (for commits, push, pull) + text editor (for making content changes) like before. Here’s a quick rundown of what I did to get my Hugo site to work:

First-time Setup

  1. Read the Installation section in the project’s README to choose which Termux version you want to install—I chose the F-Droid version.

    1termux-change-repo
    2termux-setup-storage
    3pkg update
    4pkg upgrade
    5pkg install hugo git
    6pkg clean && pkg autoclean
  2. cd into your Hugo site directory, for example, mine is located at ~/storage/shared/documents/burgeonlab

  3. Run hugo server --noBuildLock in your Hugo site directory and visit http://localhost:1313 in the browser.

Themes That Use Dart Sass

To fix the Dart Sass error message for themes that require Dart Sass:

1You need to install Dart Sass, see
2https://gohugo.io//functions/css/sass/#dart-sass:
3this feature is not available in your current Hugo version,
4see https://goo.gl/YMrWcn for more information
  1. Check current Android architecture with uname -m. It should be aarch64 which is ARM64.

  2. Download the right version of Dart Sass directly using wget (I don’t think dart-sass is available in the Termux pkg repo). The current version as of Jan 2026 is 1.97.3.

    1cd ~
    2wget https://github.com/sass/dart-sass/releases/download/1.97.3/dart-sass-1.97.3-android-arm64.tar.gz
    3tar xzf dart-sass-1.97.3-android-arm64.tar.gz
    4rm dart-sass-1.97.3-android-arm64.tar.gz
    5echo 'export PATH="$HOME/dart-sass:$PATH"' >> ~/.bashrc
    6source ~/.bashrc
    7sass --version # should display current version e.g. 1.97.3
  3. Re-run hugo server --noBuildLock and access the local server in the browser.

Troubleshooting: Hugo Server Fails to Run

If hugo server fails, try to identify the cause by adding the flag --logLevel=debug and seeing the last debug message it is stuck on, i.e., hugo server --noBuildLock --logLevel=debug.

For me, it was INFO webp: started dispatcher, which is likely caused by Termux not fully supporting WebP Hugo image processing. To remedy this, I created a separate Termux-specific configuration file that bypasses any image-related processes by adding a condition to the img.html shortcode file used for image processing.

Note

Your setup may be different. Try to find which partials or shortcodes use Hugo image processing code like images.Resize, .Fit, .Fill, .Decode, images.Encode, .Format, .Resources.Match, .Process, etc.

  1. Create a Termux config file that skips image processing, e.g. termux.toml

    1[params]
    2  skipImages = true
  2. In the relevant template(s) (in my case, it’s img.html shortcode), add the parameter check so it would skip image processing if hugo server is run with the termux.toml config.

     1{{- $skip := .Site.Params.skipImages -}}
     2{{- $src := .Get "src" -}}
     3{{- $alt := .Get "alt" | default "" -}}
     4
     5{{- if not $skip -}}
     6{{/* your existing Hugo image processing code */}}
     7<img src="{{ $src }}" alt="{{ $alt }}">
     8{{- else -}}
     9{{/* fallback: skip all Hugo image processing and output literal src */}}
    10<img src="{{ $src }}" alt="{{ $alt }}">
    11{{- end -}}
  3. On Termux, run the server with your original Hugo config plus the new Termux config.

    1hugo server --noBuildLock --config hugo.toml,termux.toml

Note

Your Hugo config file could be called config.toml or hugo.yaml, change name as necessary. Also, if your config file is not at root, include relative path.

Screenshot of Android Termux running Hugo server.

BurgeonLab is successfully running on Android!

Replacing PuppyGit with Termux Git

My Hugo source code is managed by Git. Since the beginning, I have used PuppyGit as my Git client on Android—using it to make commits, pull, and push changes back to my remote repo hosted on SourceHut. Technically I could continue using it, but it would be nice to stay within Termux to handle Git versioning since it is capable of doing so!

Setup Git with Termux

  1. Install openssh with: pkg install openssh

  2. Generate a new SSH key pair for Termux + your hosted Git provider (in my case it’s git.sr.ht) in Termux. You can use any label you want for the key, in the example below I used "user@termux", an alternative would be "your_email@domain.com".

    1ssh-keygen -t ed25519 -C "user@termux" -f ~/.ssh/id_ed25519
    2# Enter passphrase when asked, add to password manager
  3. Set the correct permissions for the ssh related files.

    1# Set permissions
    2chmod 700 ~/.ssh
    3chmod 600 ~/.ssh/id_ed25519
    4chmod 644 ~/.ssh/id_ed25519.pub
  4. Copy the newly generated public key (the one that ends in .pub) and paste it into your Git repo host settings. For example, in Sourcehut it will be under Meta > Keys > SSH Public Key. For GitHub, read Adding a new SSH key to your account and similarly, Add the SSH key to Codeberg.

    1cat ~/.ssh/id_ed25519.pub # Prints out the contents of `id_ed25519.pub`
  5. Run ssh-agent and add the newly created key to it.

    1eval "$(ssh-agent -s)"
    2ssh-add ~/.ssh/id_ed25519
  6. Test the connection with: ssh -T git@git.sr.ht it should output a greeting message if the connection is set up correctly. (For GitHub, the command would be ssh -T git@github.com and Codeberg, ssh -T git@codeberg.org.)

  7. cd into your Hugo site directory and run git status. If there are no error messages, then you have set up Termux correctly and can run your usual Git commands!

Add Official SSH Host Keys

To be on the safe side and prevent man-in-the-middle attacks, we can add the official public keys of Git hosts to our /.ssh/known_hosts file.

Tip

Here are the links to the official SSH host keys (aka SSH fingerprints) for SourceHut, Codeberg, and GitHub.

  1. Copy the SSH host keys of your Git provider.

  2. Add them to known_hosts using this command:

    1cat >> ~/.ssh/known_hosts <<'EOF'
    2<paste official SSH host keys>
    3EOF
  3. Set correct permissions: chmod 600 ~/.ssh/known_hosts

Troubleshooting: Dubious Ownership

Because Git (in Termux) is running in a directory that is owned by a different user (Android’s internal file system), it blocks Git commands unless you give it permission.

Error message may look like this:

1fatal: detected dubious ownership in repository at '/storage/emulated/0/documents/burgeonlab'
2To add an exception for this directory, call:
3
4    git config --global --add safe.directory /storage/emulated/0/documents/burgeonlab

To fix this, just run the command given in the message and re-run your Git commands.

Conclusion

I am really stoked to get everything working despite the WebP image processing hiccup. Paired with the Keychron B1 Pro keyboard (affiliate link) I bought a few months ago; my Android phone (and sometimes the iPad Mini 6) can finally be a “viable computing device” when I’m out and about or travelling! No longer do I have to lug around a laptop to be productive—a physical keyboard makes such a huge difference!

Photo of an Android phone on a card shape phone stand with a Keychron keyboard in the foreground and coffee equipment in the background.

Portable Hugo setup

Having full access to my Hugo blog on Android is now a reality, and I’m really happy to share my experience. Do you also use Hugo with Android? What’s your workflow like? Let me know.

Read the original on burgeonlab.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.