SSH Agent : Connection refused
Not sure if it's related to an update, everything was working fine so far.
I can't get the agent to load the keys on git requests anymore.
The problem :git fetch git@github.com: Permission denied (publickey).
The ssh setup :
cat ~/.ssh/config ... Host github.com-arnaudb Hostname github.com IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" ForwardAgent yes`
The agent setup :
cat ~/.config/1Password/ssh/agent.toml [[ssh-keys]] item = "Git Arnaudb" vault = "Private"
I have a key in my Private vault named Git Arnaudb
The git repo was cloned with SSH :
git remote -v origin git@github.com-arnaudb:MyRepo/Sandbox.git (fetch) origin git@github.com-arnaudb:MyRepo/Sandbox.git (push)
Also i have SSH_AUTH_SOCK in my .zshrc
export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
I can't connect to the agent it seems :
SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ssh-add -l Error connecting to agent: Connection refused
Any help would be much appreciated, thank you !
1Password Version: 8.10.34
Extension Version: Not Provided
OS Version: macOs 13.3.1
Browser: Not Provided
Comments
-
bumping this in case anyone has a solution :)
0 -
Probably a silly question but still worth asking: you're sure 1Password app is running? I occasionally see this "Connection refused" when 1Password is not running (e.g., because I intentionally killed it) or it didn't restart properly after an update.
It might be worth checking that the agent socket file exists by running
ls -l ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
from the Terminal.0 -
Try changing the Release Channel in Advanced settings and check for Updates. After I install a different version, this error mostly disappears. I switch between Beta and Nightly when it happens.
If you don't want to change the release channel, maybe updating (if a new version is available) or reinstalling could resolve this, too.
0 -
Thanks Michael and Jonas
Yes, app is running, command returns :
srw------- 1 arnaudb staff 0 May 7 18:43 /Users/arnaudb/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock
I was actually running the production versio. Swithing to Beta and updating the app fixed the issue ! Thanks for help
0 -
One observation that strikes me as unusual in your original post:
git fetch git@github.com: Permission denied (publickey).
This would imply your public key was obtained and tried, which failed. However,
ssh-add -l
is showing the connection refused error. I don't understand how this could be.I think this is related to
@github.com-arnaudb
vs@github.com
. See my comment below regarding this.One thing which may make troubleshooting easier with GitHub (I realize this is unrelated to the SSH agent socket issue):
- add
User git
in for the github.com section in your~/.ssh/config
.
The git fetch command you included in the original post is using
@github.com
and not@github.com-arnaudb
in your~/.ssh/config
file. If you want both to work, you can update the host setting to include both like this:Host github.com-arnaudb github.com Hostname github.com IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" ForwardAgent yes User git
Curious what happens when you try
ssh -v -T git@github.com
. If it's working you should see:Hi <your GitHub username>! You've successfully authenticated, but GitHub does not provide shell access.
The
-v
option should help troubleshoot which keys are being attempted.I'm not sure what else is in your
~/.ssh/config
file or what your intention is regarding thegithub.com-arnaudb
host setting, but depending on what you're trying to do, there may be better ways to setup your ssh config.0 - add
-
I replied earlier, but not sure what happened to it.
One issue with GitHub is your config is specifying
github.com-arnaudb
as the host, but the git fetch command in your original post is usinggithub.com
:git fetch git@github.com: Permission denied (publickey)
It's also notable that based on the error, Permission denied (publickey), your public key was obtained and tried.
For troubleshooting, try making the following updates to your
~/.ssh/config
:Host github.com-arnaudb github.com User git Hostname github.com IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" ForwardAgent yes`
(note
User git
added and Host updated to includegithub.com
.)Then try issuing
ssh -v -T git@github.com
.If it works you should see:
Hi <your GitHub username>! You've successfully authenticated, but GitHub does not provide shell access.
The
-v
option will help determine which keys (if any) were tried.But none of this explains why the
ssh-add -l
command you posted withSSH_AUTH_SOCK
set is receiving a connection refused error.0 -
Hi @arnaudb, one other thing I just noticed from your last message:
srw------- 1 arnaudb staff 0 May 7 18:43 /Users/arnaudb/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock
This would imply that you have not restarted the 1Password app SSH Agent since May 7. Does that sound right?
For the sake of troubleshooting, you may want to restart your Mac. Or at the very least try completely restarting 1Password (choose Quit from the icon in the menu bar). Another option would be to toggle the "use the SSH agent" option under Developer settings in the app off (restart the app) then toggle it back on again.
As last resort perhaps try reinstalling 1Password as suggested by @JonasKrausch.
0 -
Hey @Michael Mercurio
No that's not correct, Mac was restarted just before posting the main message here. Not sure what's that date about
I have also restarted the agent in 1p directly0 -
Weird. On my MacBook the timestamp of the socket is reset each time the 1Password SSH Agent restarts. But it sounds like it's working now, so 🤷
0