3

Following the tutorial on the bitbucket, I have configured ssh-agent and saved my private key in ssh-agent on Windows 10.

To start the agent, run the following:
$ eval $(ssh-agent) 
Agent pid 9700      

Enter ssh-add followed by the path to the private key file:
$ ssh-add ~/.ssh/<private_key_file> 

but after closing the git terminal and reopen it, strange thing happened.

$ ssh-add -l
The agent has no identities.

By the way, under this condition, it still need to enter password of private key.

Could somebody tell me what happened and how to fix this problem.

1 Answer 1

1

Closing the terminal likely closed the ssh-agent.

You should follow "Auto-launching ssh-agent on Git for Windows" in order to make sure that, when reopening a git bash session, the .bashrc relaunch the ssh-agent automatically.

Sign up to request clarification or add additional context in comments.

3 Comments

"Closing the terminal likely closed the ssh-agent." I'm not sure ssh-agent is so tied to its terminal. ssh-agent prints commands to set env vars and eval $(ssh-agent) sets these vars so any subsequent ssh-using program can connect to the agent. The problem AFAIU is that closing the terminal clears env vars so programs in any new terminal don't know how to connect to the agent. I suspect that agent meanwhile stays in memory.
@phd OK. I still prefer the .bashrc approach: it will make sure everything is runninng.
Yep, I understand. Good approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.