dotfiles/bin/grts

11 lines
322 B
Plaintext
Raw Normal View History

2020-03-09 10:45:13 +00: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