Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git- How to kill ssh-agent properly on Linux

Tags:

I am using git on linux, when pushing to gitlab, sometimes it either stuck at:

debug1: Connecting to gitlab.com [52.167.219.168] port 22.

or

debug1: client_input_channel_req: channel 0 rtype [email protected] reply 1

debug3: send packet: type 100

Seems restarting linux could solve it, but no body like to reboot machines. So, I am trying to kill ssh-agent process, then restart it.

But the process is always defunct after kill, and then I can't use git via ssh at all, so is there any way to restart the ssh-agent, or solve the issue described above without restarting the machine?


@Update

The ssh keys that I use include key phrase, which I would input on first use of a ssh key.

The issue usually occurs after I bring the Linux desktop back from sleep, thus the network is reconnected, not sure whether this matters?

Again, does any one knows how to kill or restart a ssh-agent agent, without making it become defunct?

like image 409
user218867 Avatar asked Mar 31 '17 09:03

user218867


Video Answer


1 Answers

You can kill ssh-agent by running:

eval "$(ssh-agent -k)"
like image 134
Eduard Mukans Avatar answered Sep 19 '22 11:09

Eduard Mukans