Add git http to ssh convert script

This commit is contained in:
2025-05-08 20:26:30 +01:00
parent ace5661025
commit 42b404922f
2 changed files with 11 additions and 0 deletions

11
scripts/gitssh Executable file
View File

@@ -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"

0
scripts/p.sh Executable file → Normal file
View File