Home›Ned Batchelder›Article

Making git hooks visible

Ned Batchelder · Oct 11, 2026

Frank Wiles wrote about an attack he nearly fell victim to: a downloaded git repo had active git hooks that would have compromised his system. Seeing the risks, I wanted to make git hooks more visible on my own machine.

A git hook is a script in the .git directory of a git repo on your machine. They run during various git operations. The important detail to understand about hooks is that they do not get installed locally when you clone a repo. A newly cloned repo never has active hooks. Hooks have to be enabled after cloning, usually by you.

The attack Frank saw was dangerous because it wasn’t a cloned repo: it was a local checkout that had hooks installed then shared as a Dropbox folder. So when it landed on Frank’s machine, the hooks were active without him realizing it.

Keep reading

Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.

More from Ned Batchelder

Human sorting, hardened

“Human sorting” is sorting strings (usually file names) so that any numbers in the names come out in the right order. For example, “file10.txt” should come after “file2.txt”, but regular sorting will put them in the wrong order. I’ve writte

Cupcake party

Today is Nat’s 37th birthday. We went to his group home yesterday to celebrate. One of Nat’s favorite things to do when he’s with us is to bake with Susan. So we had a baking party at his house to get everyone into the activity: At our hous

Evergreen posts

Because I’ve been writing this blog for so long, I often share links to very old posts. Three years ago, I added a feature: if the post is more than five years old, there’s a message next to the dateline indicating the age. The age descript

Expert asterisks

Watching discussions happening online, I see a frequent unfortunate tic I’ll call the Expert Asterisk. A beginner is asking for help, and experts are answering. Then in the spirit of completeness, an expert throws in a fact or detail far fr

Silence is golden lightning talk

This is a lightning talk I did at PyCon US 2026: Silence is Golden. The overall message is to leave some quiet time so that reluctant speakers have a chance to participate. I start with a jokey disclaimer because I followed Simon Willison w