Couldn't find the answer to this anywhere but finally figured out the problem and wanted to share the solution.
Problem: After using 1Password ssh agent, trying to git commit
through a terminal on a Mac yields the following error:
error: Could not connect to socket. Is the agent running?
fatal: failed to write commit object
Solution:
1Password modifies two files where it specifies which ssh to use; ~/.gitconfig
and ~/.ssh/config
. After removing 1Password as the default ssh agent, these two files have to be reverted as well:
In ~/.ssh/config
, remove this:
Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
And in your ~/.gitconfig
, replace this:
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign
with this path to wherever your preferred ssh
is (probably /usr/bin/ssh
):
[gpg "ssh"]
program = /usr/bin/ssh
This solution applies to both command-line git and GitHub Desktop clients.
I noticed that my 1Password wasn't running. So I started my 1Password application and it worked right away.