dotfiles/bin/grts

11 lines
322 B
Plaintext
Raw Permalink Normal View History

2020-03-09 11:45:13 +01:00
#!/usr/bin/env bash
# Converts a http(s) remote to an ssh one
remote=$(git remote -v | grep origin | head -n 1 | cut -d $'\t' -f 2 | cut -d ' ' -f 1)
server=$(echo $remote | cut -d '/' -f 3)
user=$(echo $remote | cut -d '/' -f 4)
repo=$(echo $remote | cut -d '/' -f 5)
git remote set-url origin git@$server:$user/$repo