dot/.config/scriptrc/convert_git_remote.sh
2023-07-22 14:49:09 +02:00

7 lines
293 B
Bash

# converts old https remote to ssh
function convert_git_remote() {
local remote="${1:-origin}"
new_remote=$(git remote get-url ${remote} | sed 's/https:\/\/github.com\//git@github.com:/' | sed 's/$/.git/')
git remote set-url ${remote} ${new_remote}
echo "set ${remote} to ${new_remote}"
}