From c627815b59dbc69e25baf848a968dbd034cd6967 Mon Sep 17 00:00:00 2001
From: Jenia Jitsev <jitsev1@jwlogin08.juwels>
Date: Mon, 26 Apr 2021 15:42:50 +0200
Subject: [PATCH] JJ: adding helpers to handle ssh keys

---
 README.md   |  2 ++
 init_key.sh | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100755 init_key.sh

diff --git a/README.md b/README.md
index 072761e..2e053af 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
 # Helper utilities and scripts
 
 Different helpful utilities and scripts
+
+- `init_key.sh` : edit and run this to initialize a ssh key, eg for handling repositories without necessity to type in passwords each time
diff --git a/init_key.sh b/init_key.sh
new file mode 100755
index 0000000..54bd372
--- /dev/null
+++ b/init_key.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# handling ssh keys
+# execute this with "source ${PATH_TO_SCRIPT}/init_key.sh
+
+# plug here your key name, eg "id_rsa"
+SSH_KEY_NAME=""
+
+if [ -z "$SSH_AUTH_SOCK" ]
+then
+  eval `ssh-agent -s`
+  ssh-add ~/.ssh/${SSH_KEY_NAME}
+fi
+
-- 
GitLab