# GPG Signing git commits on macOS keeps asking for passphrase

> This blog provides a solution for macOS users who encounter repetitive passphrase prompts when signing Git commits with GPG. By installing pinentry-mac via Homebrew and configuring GPG-agent to utilize it, users can seamlessly integrate passphrase management with the macOS keychain, streamlining the signing process.

- Author: [Azraf Al Monzim](https://monzim.com/)
- Published: 2024-05-07
- Updated: 2026-06-13
- Topic: Guides
- Canonical: https://monzim.com/blog/gpg-signing-git-commits-on-macos-keeps-asking-for-passphrase

---

When working with Git on macOS and signing commits using GPG, you might encounter the inconvenience of repeatedly being asked for your passphrase. This can be mitigated by saving the passphrase in the macOS keychain. However, GPG-agent lacks built-in support for this feature. Here's how you can address this issue:

**Prerequisites Ensure you have Homebrew installed on your macOS system.**

Installation Install the `pinentry-mac` tool using Homebrew:

```bash
brew install pinentry-mac
```

## Configuration

1.  Determine the path to **pinentry-mac**:

    ```bash
    which pinentry-mac
    ```

2.  If not already existing, create the file _**~/.gnupg/gpg-agent.conf**_
3.  Add the following line to **gpg-agent.conf**, replacing the path with your own **pinentry-mac** path
4.  vi _**~/.gnupg/gpg-agent.conf**_

    ```bash
    pinentry-program /opt/homebrew/bin/pinentry-mac
    ```

## Restart GPG-Agent

Stop the currently running **gpg-agent:**

```bash
gpgconf --kill gpg-agent
```

With these steps, you've configured GPG to use **pinentry-mac**, which integrates with the macOS keychain, eliminating the need for repeatedly entering your passphrase when signing Git commits.

Reference: [Methods of Signing Git Commits on MacOS](https://gist.github.com/troyfontaine/18c9146295168ee9ca2b30c00bd1b41e?permalink_comment_id=3660126)
