You can add co-authors to a GitHub commit using the Co-authored-by
field in the git commit message. But what if your co-author doesn't have a
public email address listed on GitHub?
No problem, you can use this handy script to automatically discover a users' display name and per-account "noreply" email address that'll mark their account as a co-author without a public email address.
#!/bin/bash
login="$@"
read id display_name < <(echo $(curl -s "https://api.github.com/users/$login" | jq -r '.id, .name'))
echo "Co-authored-by: $display_name <$id+$login@users.noreply.github.com>"
I've added this script to my PATH in a file named coauthoredby, so I can call the script like so:
$ coauthoredby sethmlarson
Co-authored-by: Seth Michael Larson <18519037+sethmlarson@users.noreply.github.com>
And this can be used auto-magically with multi line git commits,
so if I'm trying to credit
$ git commit -m 'Fixing bugs as usual' \
--trailer '$(coauthoredby pquentin)'
Resulting in this git commit message:
$ git log
Author: Seth Michael Larson <sethmichaellarson@gmail.com>
Date: Fri Oct 24 11:07:55 2025 -0500
Fixing bugs as usual
Co-authored-by: Quentin Pradet <42327+pquentin@users.noreply.github.com>
Wow, you made it to the end!
- Share your thoughts with me on Mastodon, email, or Bluesky.
- Browse this blog’s archive of 156 entries.
- Check out this list of cool stuff I found on the internet.
- Follow this blog on RSS or the email newsletter.
- Go outside (best option)