Storing dotfiles in GitHub Revisited

Using dotbot to bootstrap a dotfiles repository

A while ago, I wrote about using a bare git repository to manage my dotfiles. That worked somewhat well, but it had some shortcomings. Honestly, it’s been a while since I switched from that particular setup, and I forget what my main motivating reasons were. I do vaguely recall running config clean one day… that removes any files in the profile that aren’t in the repository, which would essentially delete my entire user profile… that might have had something to do with it.

Regardless of my motivations, I quickly adapted to using an open source application called dotbot to help with the task becuase it just ended up being a better way to do things. First, instead of making a bare repository out of my entire user profile and ignoring files that are not under version control, all of the files are in a normal repository and symlinked to their original locations. Fortunately dotbot handles all of this more gracefully.*

(* with a quick local security policy modification in Windows)

Since I already had my dotfiles set up to be shared, I only needed to set up dotbot. However, if you’re new this sort of thing, you have to keep in mind the target machines that you use. For me, that includes machines from Raspberry Pi Zeros through my Windows 11 desktop and both work and personal. Keep in mind that these configurations include all of my user preferences. I want my shell key bindings to be the same at work and home, for example, so things have to play nice on both sides of that aisle. Fortunately, that’s not too difficult.

Know Your Environment

The user environment variables can give a lot of hints that can set things for work or home. I want certain things to be the same between work and home, but not everything. However, I want things to be the same between workstations at work and between computers at home. Fortunately, I can look at an environment variable for a hint. In this case, $ENV:USERDOMAIN is very helpful:

if($IsWindows -and
   ($ENV:COMPUTERNAME -ne $ENV:USERDOMAIN) -and 
   (Test-Path -Path (Join-Path $ENV:USERPROFILE ".dotfiles" "powershell" "profile.$ENV:USERDOMAIN.ps1"))) {
    . $(Join-Path $ENV:USERPROFILE ".dotfiles" "powershell" "profile.$ENV:USERDOMAIN.ps1")
}

This excerpt will source in a separate profile.WORKDOMAIN.ps1 file with some work-specific functions.

Windows Modification

Everything works out-of-the-box as documented except for one thing – in Windows, one needs Administrator rights to create symbolic links. Fortunately, this is pretty easy to overcome.

  1. Open Local Security Policy. It’s easiest to search for it, but it can be found under Windows Tools in the Windows 11 Programs menu.
  2. In the left pane, navigate under Security Settings > Local Policies > User Rights Assignment. On the right pane, find and open “Create symbolic links.”
  3. In the “Create symbolic links properties” window that opens, click “Add User or Group…”
  4. In the “Select Users or Groups” box that opens, type “Authenticated Users” in the text box and click OK.
  5. Close Local Security Policy and restart the computer for the changes to take effect.

2025

Making PowerShell “Posh”

Back in the days when DOS and Windows were separate programs, the default Command Prompt didn’t look exactly the way that it does now. I can’t recall if it w...

Back to Top ↑

2024

PowerShell Short Scripts

As a Data Engineer using Mirth Connect, it’s often tricky to review my team’s merge requests because the merge request document contains the XML representati...

PowerShell Short Scripts

When dealing with Python dependencies, it’s sometimes necessary to determine if a given project is using a given version of a library. Since our team is usin...

Storing dotfiles in GitHub Revisited

A while ago, I wrote about using a bare git repository to manage my dotfiles. That worked somewhat well, but it had some shortcomings. Since, I’ve started us...

Python Context Managers

One of my current projects involves some improvements to code that I wrote last year – specifically enhancing the “Patient Identity Fixer”, which is my pet p...

PowerShell for Data Transformation: JSON

My team at work has a custom FHIR resource that we work with often called an Operation Outcome. We generate one of these for nearly every record we process, ...

Back to Top ↑

2021

Raspberry Pi Zero W “Busy Light”

COVID-19 has us many of us working from home. My husband and I are both fortunate enough to be in this group. However, as a teacher, his schedule is very pre...

Back to Top ↑

2020

Raspberry Pi Setup Script

When I set up a Raspberry Pi, there are a few things that I have to do right out of the gate to make things easier on myself. They involve putting a few file...

Storing dotfiles in GitHub

While I don’t use Linux as my primary operating system, I do use it a lot both at home and at work. It can be frustrating to try to sync up configurations be...

Nitro Cold Brew at Home!

Anyone who knows my husband or me knows that we really like our cold brew, and they also know that we make our own at home. Nitro cold brew has become a bit ...

OpenVPN On Raspberry Pi

So you want to run an OpenVPN Server on a Raspberry Pi? I did too, but it wasn’t easy to figure out the first time. If you want to skip all of this and do it...

Back to Top ↑