Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I run the ssh-agent auto in the zsh environment?

I use the zsh and the oh-my-zsh. When I use the github and want to use the key to upload.

I always find the

#git push Permission denied (publickey). fatal: The remote end hung up unexpectedly 

Because I have not add the key

#ssh-add -l Could not open a connection to your authentication agent. 

so I have to start the ssh-agent and add the key when I want to push or pull

#ssh-agent zsh #ssh-add ~/.ssh/id_rsa 

How can I add these command in the script,so I don't need type the commands?

like image 712
wcc526 Avatar asked Feb 23 '14 07:02

wcc526


People also ask

Does ssh-agent need to be running?

On most Linux systems, ssh-agent is automatically configured and run at login, and no additional actions are required to use it. However, an SSH key must still be created for the user. The ssh-agent command outputs commands to set certain environment variables in the shell.


1 Answers

open .zshrc in a text editor:

vim ~/.zshrc 

Add ssh-agent to the plugins list and save:

plugins=(git ssh-agent) 

You may want to immediately reload your .zshrc settings:

source ~/.zshrc 
like image 199
Ilan Frumer Avatar answered Sep 29 '22 08:09

Ilan Frumer