From d554a370ee95cf718c30ad4a8e0876b3f5e8415d Mon Sep 17 00:00:00 2001 From: samedamci Date: Tue, 12 May 2020 18:25:34 +0200 Subject: [PATCH] Add very stupid 'ghrc' script --- .local/bin/scripts/ghrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .local/bin/scripts/ghrc diff --git a/.local/bin/scripts/ghrc b/.local/bin/scripts/ghrc new file mode 100755 index 0000000..312ef4a --- /dev/null +++ b/.local/bin/scripts/ghrc @@ -0,0 +1,14 @@ +#!/bin/sh + +# Very stupid script to create remote GitHub repo and replace +# https to ssh remote connection. + +[ ! "$(git status 2>/dev/null)" ] && git init + +gh repo create | sed 's/https:\/\//Added remote: git@/g' + +url="$(git remote -v | awk 'NR==2 { print $2 }' | \ + sed 's/.*https:\/\//git@/g; s/com\//com:/g')" + +git remote remove origin +git remote add origin "$url"