Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

`ssh-add -l` returning "Error connecting to agent: Bad file descriptor"

ScottKFraley April 1, 2021

I have Googled this six ways to Sunday, but cannot find any answers for this particular issue.

What's killing me about this is that last week, this was working just fine! And now, this is happening. 

I open a Git Bash, and here's the 'log' of what happens.

.bashrc running...
in the if condition...
Initializing new SSH agent...
Identity added: /c/Users/Scott/.ssh/AqweevaBB_id_rsa (Scott@MALP04)
.bash_profile run and done.

Scott@MALP04 MINGW64 /c/Dev/Aqweeva/repos/netgcs_web_main_api (develop)
$ git status
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

Scott@MALP04 MINGW64 /c/Dev/Aqweeva/repos/netgcs_web_main_api (develop)
$ git ls-remote Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Scott@MALP04 MINGW64 /c/Dev/Aqweeva/repos/netgcs_web_main_api (develop)
$ ssh-add -l
Error connecting to agent: Bad file descriptor

So if anyone can tell me what to try next, I'd really appreciate it. (I've gone through all of the steps I can find for the `Permission denied (publickey)` error, and nothing seems to get rid of that dang Bad file descriptor error.)


1 answer

1 accepted

0 votes
Answer accepted
ScottKFraley April 1, 2021

Well, apparently the path to the dang `ssh.exe` in my `.gitconfig` was pointing to a bad (perhaps out of date) EXE. I changed it to the actual Git for Windows version/instance and all is working again.


new_trying September 29, 2022

Excuse me,could you please tell me what is the direction of the file '.gitconfig' and how should i change it?


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events