Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Keychain workaround #4583
I'm trying to run
but get the following error:
If I try to run it as follows:
I understand that fish is not POSIX compatible and it's probably not going to work directly.
My workaround right now is to launch
What would be a better way of doing that?
I tried doing it with a script:
but there is no effect as I still get the "Permission denied error".
One method would be to put
However, a preferred method is to start keychain in your login or interactive shells only, and then to source the files it produces:
if status --is-interactive keychain --quiet --agents ssh github end begin set -l HOSTNAME (hostname) if test -f ~/.keychain/$HOSTNAME-fish source ~/.keychain/$HOSTNAME-fish end end
Didn't know that, thank you!
Your second solution works, but requires me to activate keychain and insert the password when I launch terminal with
So I ended up with the following function:
One small question, is there a way to pass a number of arguements? As $1 $2 and so on in bash?
You can slice
function foo echo First argument $argv echo Second argument $argv echo And the rest $argv[2..-1] echo All arguments backwards $argv[-1..1] end foo (seq 1 6) First argument 1 Second argument 2 And the rest 2 3 4 5 6 All arguments backwards 6 5 4 3 2 1
@gour Good evening! I use the version posted above, since my only use for GPG right now is "pass".
If you want both gpg and ssh, I'd suggest something like this:
Now if you want to use GPGv2 key "arst" you would go
If you use exclusively GPGv1 or GPGv2, you can just hardcode it into the snippet and remove the 3rd argument.
How/when do you invoke kchain.fish function?
I'd expect to run it after login...
I see that keychain now has
I believe there is no need for GPGv1 here any longer, so I can hardcode GPGv2 usage...
I use something along the lines of this in my
if status is-login keychain --clear --quiet end if test -f ~/.keychain/(hostname)-gpg-fish source ~/.keychain/(hostname)-gpg-fish end if test -f ~/.keychain/(hostname)-fish source ~/.keychain/(hostname)-fish end
What do you think about submitting some more info to the keychain in order to have complete example for fish shell, since it seems that the current snippet:
is both incomplete - no gpg(2) agent), as well as incorrect?