don't worry, it's probably fine

How to tell if your GitHub wiki has stuff in it

11 Nov 2019

nablopomo git wiki

GitHub repositories can have wikis, which may or may not contain content.

There’s no way to tell in the API as the has_wiki field is true by default. It turns out this requires a little bit of fudge to find out.

As luck would have it, GitHub wikis are git repositories themselves.

A repository at has a wiki git repo at, and with a bit of scripting we can tell whether it’s safe to remove the wiki with a tool like Terraform.


git ls-remote${USER}/${REPO}.wiki.git 2&>1 > /dev/null;

if [[ $? -eq 0 ]]; then
    echo "${REPO} has a wiki";
    echo "${REPO} has no wiki";

It uses a feature of git called ls-remote which among other things grabs information about a repository without needing to cloning it.

I used this today to inspect a fleet of repositories to lean which ones had non-empty wikis. Doing this manually would have been a tedious and morale-sapping task.

I’ll count this as a win!

November is National Blog Posting Month, or NaBloPoMo. I’ll be endeavouring to write one blog post per day in the month of November 2019 - some short and sweet, others long and boring.