From 3f82b5c291abf92a722240665929ab7b62703d94 Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Thu, 8 May 2025 20:26:30 +0100 Subject: [PATCH] Add git http to ssh convert script --- scripts/gitssh | 11 +++++++++++ scripts/p.sh | 0 2 files changed, 11 insertions(+) create mode 100755 scripts/gitssh mode change 100755 => 100644 scripts/p.sh diff --git a/scripts/gitssh b/scripts/gitssh new file mode 100755 index 00000000..1e2e130a --- /dev/null +++ b/scripts/gitssh @@ -0,0 +1,11 @@ +#! /bin/sh + +current_url=$(git remote get-url origin) +if echo "$current_url" | grep -q '^git@'; then + echo "Remote origin already uses SSH." + exit 0 +fi + +ssh_url=$(echo "$current_url" | sed -E 's|https?://([^/]+)/(.+)|git@\1:\2|') +echo "Changing remote origin from $current_url to $ssh_url" +git remote set-url origin "$ssh_url" diff --git a/scripts/p.sh b/scripts/p.sh old mode 100755 new mode 100644