Cleaning up an old notes repository
On my second laptop, ctl2, I had a folder called sysadmin. It held everything I had written down while I worked on my home network: notes from the weeks when I flashed OpenWrt on the access points, a lab for LDAP and Kerberos, the setup of an old reverse proxy, and how the disks on the home server are mounted. I turned the folder into a Git repository and pushed it to my Forgejo, so that it lives next to the Ansible repository.
Then I read what I had pushed. There were passwords in plain text, firmware images, the local state directory of a coding assistant, and a project that I had replaced months ago. The repository is private, but “private” only means fewer people can read it. This post is how I cleaned it up, in an order that works.
What you’ll have at the end
- A repository with notes only: no credentials, no binaries.
- Secrets that are rotated, and referenced by their name in the password store.
- What is really configuration moved into Ansible, and proven there with a
--checkrun. - Stale documents marked as stale.
- A new history, on the server and on every clone.
Step 0: a leaked password stays leaked
Rewriting the Git history stops a secret from spreading further. It doesn’t take it back from anybody who already has a copy: a clone on another laptop, a backup of the Forgejo server, a mirror. So the first step is to change every password that was ever in the repository. The cleanup only comes after that.
For me that was the Pi-hole admin password and the root password of the OpenWrt access points. Pi-hole got a new password the same day. The access points are on my list, and until then, I count their password as public.
Step 1: find every secret, in the history too
The current files are easy. The history is where the old versions are:
# the current files
git grep -niE 'passw|passphrase|psk|secret|token|api[_-]?key|userPassword'
# every version of every file, in all branches
git log -p --all | grep -niE 'passw|passphrase|psk|secret|token|api[_-]?key|userPassword'
The pattern finds more than secrets: every sentence that mentions a password. That’s fine. Read each hit. Mine came from two places:
- the network notes: the root password of the access points and the Pi-hole password.
- an LDIF file for the LDAP lab, with the
userPasswordof a bind account.
Tools like gitleaks and trufflehog search with patterns for hundreds of token formats (links at the end). For a small repository of notes, grep and reading did the job.
Step 2: name the secret, don’t write it down
A note needs to say where a password is, not what it is. All my passwords are in pass, so the notes now say:
Admin password (SSH root / LuCI), the same on all OpenWrt devices: pass home/openwrt-root.
The LDIF lost its userPassword line. The lab’s README now says that the bind account gets its password at deploy time, from pass, and never from a file in Git.
The coding assistant’s state directory went out completely, and into .gitignore. It’s local state of a tool and doesn’t belong in any repository, secrets or not.
Step 3: binaries out, checksums in
The repository had the four OpenWrt images that I had flashed. Git stores every version of a binary forever, and the images are on the OpenWrt download server anyway. But I wanted to know which exact image is on which device. So the images left, and a checksum file with the download URLs stayed:
# firmware/SHA256SUMS
<sha256> openwrt-25.12.5-ath79-generic-tplink_archer-c7-v1-squashfs-factory.bin
<sha256> openwrt-25.12.5-ath79-generic-tplink_archer-c7-v1-squashfs-sysupgrade.bin
<sha256> openwrt-25.12.5-ipq806x-generic-netgear_r7800-squashfs-factory.img
<sha256> openwrt-25.12.5-mvebu-cortexa9-linksys_wrt3200acm-squashfs-factory.img
Before I deleted the images, I checked them against the official checksums. An image of unknown origin on a router is the last thing I want:
base=https://downloads.openwrt.org/releases/25.12.5/targets
curl -fsS "$base/ipq806x/generic/sha256sums" | grep netgear_r7800 > official.txt
sha256sum openwrt-25.12.5-ipq806x-generic-netgear_r7800-squashfs-factory.img
# same hashes as in official.txt?
All four matched. The .gitignore keeps new images out:
.claude/
network/firmware/*.bin
network/firmware/*.img
ldap/certs/
Step 4: mark what is stale
A document that looks current but isn’t is worse than no document. I trust it, and it’s wrong. So every document that I didn’t check against the live network got a status line at the top:
Status as of 2026-09-28, the end of the OpenWrt sessions; not yet re-checked against the
live network. The detailed plan file those sessions referred to is lost: this document
is the only record.
> **Status (2026-11-23): lab, not deployed.** Phase 1 was drafted (quadlets, LDIFs, cert
> script), but nothing runs on the home server: no container, volume or timer.
The second one also says what has to happen before the lab goes live: it becomes an app in the Ansible repository, and the container images need a fresh look. The images it used are no longer published for free.
The original plan of the whole project went into archive/, with a note that it is history and not the current state.
Step 5: move what is really code
One folder described how the three Drobo disk boxes on the home server are mounted: the UUIDs, the mount options, and the owner of the share directories. That’s no note. That’s configuration, and it belongs in Ansible. The Samba role got two lists:
# host_vars/home1.yml
samba_mounts:
- {path: /mnt/drobo/Drobo01, src: UUID=<uuid>, fstype: ext3,
opts: "defaults,nofail,x-systemd.device-timeout=10s", owner: nobody, group: nobody, mode: "0777"}
# ... Drobo02 and Drobo03 the same
samba_dirs:
- {path: /mnt/drobo/Drobo01/Scans, owner: nobody, group: nobody, mode: "0775"}
# roles/samba/tasks/main.yml
- name: Share disks in fstab, mounted
ansible.posix.mount:
path: "{{ item.path }}"
src: "{{ item.src }}"
fstype: "{{ item.fstype }}"
opts: "{{ item.opts }}"
dump: "0"
passno: "2"
state: mounted
loop: "{{ samba_mounts }}"
- name: Share disk roots
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop: "{{ samba_mounts + samba_dirs }}"
nofail and the short device timeout let the server boot when a Drobo is off. Without them, systemd waits 90 seconds for the disk and then drops into emergency mode.
The test is the same as for every host I adopted (see the Ansible post):
ansible-playbook playbooks/site.yml -l home1 -t samba --check --diff
changed=0: the role describes exactly what the server already has. After that, the folder with the notes could go.
Step 6: delete what is dead
The old reverse proxy setup was a Traefik with Docker Compose, from before I moved everything to rootless Podman quadlets. Its replacement has run for months. I deleted the folder. Git keeps it in the history, and in the next step the history goes too.
The new layout:
sysadmin/
├── README.md what lives here and what lives in the Ansible repository
├── network/ network notes, diagrams, firmware checksums
├── ldap/ the LDAP/Kerberos lab (not deployed)
└── archive/ the old plan, kept as history
Step 7: a new history
There are two ways to remove secrets from the history:
- Rewrite it and keep the commits: git filter-repo with
--replace-textor--invert-paths. That’s the right tool when the history has value. - Start a new history with one commit. My history had no value for me, so that’s what I did:
git checkout --orphan fresh
git add -A
git commit -m "sysadmin: home network docs, LDAP lab, archived plan"
git branch -D main
git branch -m main
git push --force origin main
--orphan starts a branch without a parent. The working tree stays, so git add -A takes the cleaned files as they are.
If the server protects the branch against force pushes, allow it for this one push, and turn the protection on again afterwards.
Step 8: the server and the other clones still have it
After the force push, the old commits are unreachable, but they are not gone:
- The server. Forgejo keeps unreachable objects until a garbage collection runs. An admin can start one in the site administration, under the maintenance operations. Until then, anybody who knows an old commit hash can still open it. Pull requests also keep references to old commits.
- The other clones. The clone on
ctl2still had the old history. Agit pullthere would have merged the old history back into the new one, and the next push would have uploaded everything again. Delete such a clone and clone again. If you must keep it, rungit fetch && git reset --hard origin/main, and know that its reflog still has the old commits for a while. - Backups. The backup of the Forgejo server has the old objects until the backup’s retention removes them.
Check it
In a fresh clone:
git clone ssh://git@git.example.org/alice/sysadmin.git /tmp/check && cd /tmp/check
git rev-list --count --all # 1
du -sh .git # 148K
Then search for the actual secrets, not for patterns. grep -F -f - reads the search strings from stdin, so the password never shows up on the screen or in the shell history:
pass show home/old-router-password | head -1 | grep -rqF -f - . && echo LEAK || echo clean
Do this for each password that was ever in the repository. Old passwords too: after the rotation in step 0, those are the ones the history contained.
The rules, in the README
- No credentials. Name the pass entry instead (`home/...`).
- No binaries. Keep checksums and download URLs.
- What becomes configuration moves to the Ansible repository.
- A document that isn't checked against the live system gets a dated status line.
The rules are short because they have to work when I’m tired, at the end of a long evening with the routers. That’s exactly when the passwords got into the notes the first time.
Further reading
- git filter-repo: rewrite the history and keep the commits, with
--replace-textand--invert-paths. - Removing sensitive data from a repository (GitHub): the full procedure, with the server side and the clones.
- gitleaks and trufflehog: scanners for secrets in the working tree and the history.
- git checkout –orphan: a branch without a parent.
- git gc: when unreachable objects really go.
- OpenWrt: verify the firmware checksum: the official way to check an image.
- ansible.posix.mount:
state: mountedand the fstab options. - pass: the password store that the notes now point to.