mirror of
https://github.com/danhper/fish-ssh-agent.git
synced 2025-09-28 06:35:27 +00:00
Initial commit.
This commit is contained in:
22
README.md
Normal file
22
README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# fish-ssh-agent
|
||||||
|
|
||||||
|
Utility functions to start your ssh agent when using fish shell.
|
||||||
|
You will only need to run `ssh-add` and type your password once,
|
||||||
|
after the running ssh_agent should do the work for you.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Using [fundle](https://github.com/tuvistavie/fundle) (recommended)
|
||||||
|
|
||||||
|
Add
|
||||||
|
|
||||||
|
```
|
||||||
|
fundle plugin 'tuvistavie/fish-ssh-agent'
|
||||||
|
```
|
||||||
|
|
||||||
|
to your `config.fish`, reload your shell and run `fundle install`.
|
||||||
|
|
||||||
|
### Manually
|
||||||
|
|
||||||
|
Put `functions/__ssh_agent_start` your `~/.config/fish/functions` directory,
|
||||||
|
and source `init.fish` on startup.
|
5
functions/__ssh_agent_start.fish
Normal file
5
functions/__ssh_agent_start.fish
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
function __ssh_agent_start
|
||||||
|
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
|
||||||
|
chmod 600 $SSH_ENV
|
||||||
|
source $SSH_ENV > /dev/null
|
||||||
|
end
|
13
init.fish
Normal file
13
init.fish
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
if test -z "$SSH_ENV"
|
||||||
|
setenv SSH_ENV $HOME/.ssh/environment
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -z "$SSH_AGENT_PID"
|
||||||
|
if test -f $SSH_ENV
|
||||||
|
source $SSH_ENV > /dev/null
|
||||||
|
end
|
||||||
|
ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep ssh-agent > /dev/null
|
||||||
|
if test $status -ne 0
|
||||||
|
__ssh_agent_start
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user