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