How to use ssh-agent with the fish shell
This article describes how to start the ssh-agent when using the fish shell.
Overview
When using github it is now a requirement to use the ssh-agent to login to the service. Otherwise new commits cannot be pushed to the remote repository. The github website only describes how to do set this up for the bash-like and c-like shells. If the same command is used for a fish shell it fails:
|
|
Solution
The solution is to start the ssh-agent like for C-shells:
|
|
Fish alias
To make it easier to start the ssh-agent, it can be convenient to define a new shell alias to start the ssh agent:
|
|
Automatic start of ssh agent
Some developers might prefer to automatically start the ssh agent if its not already started. There is a great solution in this github repo.
Just follow the install instructions or do the following:
|
|
This adds two functions to your ~/.config/fish/functions
file. To load the agent when
your shell starts, just add the following to your ~/.config/fish/config.fish
file. This
will automatically start the ssh agent.