Update Add-SshKey function in Windows and Linux

This commit is contained in:
2020-07-14 20:52:45 +01:00
parent 4f7c28ffe6
commit 1f10d5cbe5
2 changed files with 15 additions and 1 deletions

14
bin/bin/add-sshkey Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
TIMEOUT="1h"
NAME=$1
if [ -z "$NAME" ]; then
ssh-add -L
else
if [ -f "~/.ssh/id_ed25519_${NAME}" ]; then
ssh-add -t $TIMEOUT "~/.ssh/id_ed25519_${NAME}"
else
echo "No key named ${NAME} found..."
fi
fi

View File

@@ -1,5 +1,5 @@
# Add a SSH key to SSH-Agent
function Add-Key {
function Add-SshKey {
if ($args.Count -gt 0) {
$filename = "$ENV:USERPROFILE\.ssh\id_ed25519_" + $args[0]
if (!(Test-Path $filename -PathType Leaf)) {