A git pre-push hook that stops identity leaks before leaving your machine
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-09 23:54:35 +02:00
src fix: resolve hooks dir via git rev-parse for install purposes 2026-10-09 23:54:35 +02:00
.gitattributes initial commit 2026-10-08 10:30:16 +02:00
.gitignore feat: implement owner extraction from the repo url 2026-10-08 23:13:11 +02:00
cmake.toml fix: add missing bracket in cmake 2026-10-08 11:06:38 +02:00
CMakeLists.txt fix: add missing bracket in cmake 2026-10-08 11:06:38 +02:00
cmkr.cmake initial commit 2026-10-08 10:30:16 +02:00
compile_commands.json chore: work out a config format 2026-10-08 12:27:15 +02:00
README.md readme fixups 2026-10-09 23:39:12 +02:00
sample.txt chore: work out a config format 2026-10-08 12:27:15 +02:00

git-id

A simple hook for git that stops you from pushing commits that use the wrong identity

What is this?

git-id is a pre-push hook that checks the author and committer emails of outgoing commits against the owner of the repository in the remote URL.

Example: You have your user account and own an organization and you do not want either identity to accidentally leak into the other, this pre-push hook will block the outgoing commit(s)


Install

Simply run git-id install within a repository and the hook will be installed automatically!

You may also want to enforce this globally, in which case you can simply pass the --global flag to the previous command.

Note

Applying this globally will prevent any pre-existing hooks from running

Usage

  1. Create a config here: ~/.git-identities
  2. Setup your identities, an example entry looks like this:
    owner1|owner2: user@mail.com, user@second-mail.com
  3. Use git and once a mis-match occurs, the hook will catch it

Troubleshooting

  • How do I bypass this hook?
    • You can simply run git push --no-verify and the hook will be skipped