mirror of
https://github.com/nikdoof/dotfiles.git
synced 2026-01-30 19:08:16 +00:00
Update Add-SshKey function in Windows and Linux
This commit is contained in:
14
bin/bin/add-sshkey
Normal file
14
bin/bin/add-sshkey
Normal 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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Add a SSH key to SSH-Agent
|
# Add a SSH key to SSH-Agent
|
||||||
function Add-Key {
|
function Add-SshKey {
|
||||||
if ($args.Count -gt 0) {
|
if ($args.Count -gt 0) {
|
||||||
$filename = "$ENV:USERPROFILE\.ssh\id_ed25519_" + $args[0]
|
$filename = "$ENV:USERPROFILE\.ssh\id_ed25519_" + $args[0]
|
||||||
if (!(Test-Path $filename -PathType Leaf)) {
|
if (!(Test-Path $filename -PathType Leaf)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user