惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
I
InfoQ
IT之家
IT之家
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
博客园_首页
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler

alexwlchan’s notes

What is WS11 1DB? Blocking referrers with Caddy How to type a Spanish question mark (¿) on a Mac Non-overlapping type comparisons and Python type checkers Why does t.Setenv panic after t.Parallel? Use Path.glob() and Path.rglob() for typed versions of glob.glob() Curious clocks and colourful eyes Track which templates are used by Jinja2 Archeologists distinguish between “sherds” and “shards” A single command to test all my changed Go packages Disable the new message animations in WhatsApp Finding high-churn folders that bother Backblaze Managing the caption of a photo with AppleScript (but not PhotoKit) Goodhart’s and Campbell’s Law are different Notes from The Cornishman No. 176 (Spring 2026) Notes from The Cornishman No. 176 (Spring 2026) GitUp can’t diff text files larger than 8MB Home Testing the width of a page on a mobile device using Playwright Disable AirPods charging notifications Start a Caddy server in a subprocess during a Python session Filter a list of JSON object based on a list of tags HOME_GET_ME_HOME is a Citymapper Shortcuts action The FileExistsError exception exposes a filename attribute The red-lined bubble snail Why can’t Python connect to example.com? Useful type hints for Python How to truncate the middle of long command output AirPlay Receiver can interfere with Flask apps What’s the main prefix in SQLite queries?
Always-on SSH agent forwarding with my Git pushes
2026-07-05 · via alexwlchan’s notes

If I want to use ssh -A every time I do a Git push, I need to add the remote host to my ~/.ssh/config.

All the words and code for this website are in a Git repo. The canonical copy of the repo is a bare repository on my Mac mini, which has a post-receive hook that builds a copy of the site and uploads the files to my web server.

If I’m working on my Mac mini, this works fine – the SSH key for the web server is in my local keychain, so when I push the post-receive hook can upload to the web server.

If I’m working on my laptop, I need some extra config – when I push to the Mac mini, the post-receive hook can’t get the SSH key from the Mac mini’s keychain, and publishing to the web server fails.

I’ve fixed this by adding an entry to ~/.ssh/config on my laptop:

Host phaenna-mac-mini
    HostName phaenna-mac-mini
    User alexwlchan
    ForwardAgent yes

This tells my laptop that any time it opens an SSH connection to phaenna-mac-mini, it should use SSH agent forwarding. (The equivalent of running ssh -A for a manual connection.)

This means my laptop’s SSH keys get forwarded to the Mac mini, and they’re available to the post-receive hook. My laptop can SSH to my web server, so the forwarded keys allow the post-receive hook to publish correctly.

This config includes any SSH connection, including those created by Git. I thought maybe I’d need config in every repo, but the global SSH config file seems to be enough.