Initial commit.

This commit is contained in:
Daniel Perez 2015-11-04 21:34:14 +09:00
commit 5aa699d465
3 changed files with 40 additions and 0 deletions

22
README.md Normal file
View 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.

View 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
View 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