Skip to content

Instantly share code, notes, and snippets.

@salkin-mada
Last active November 26, 2020 23:04
Show Gist options
  • Save salkin-mada/3f69c659df2718b1a30979eccee063ad to your computer and use it in GitHub Desktop.
Save salkin-mada/3f69c659df2718b1a30979eccee063ad to your computer and use it in GitHub Desktop.
ssh-ify https clones
#!/usr/bin/zsh
server='github.com'
username='so-schön-ein-Benutzername'
repo_name=$(basename `git rev-parse --show-toplevel`)
old_origin=$(git remote -v | head -n 1 | awk '{print $2}')
echo "switching to ssh on repo $repo_name"
echo "old origin -> $old_origin"
echo "using -> @$server:$username/$repo_name.git"
git remote set-url origin git@$server:$username/$repo_name.git
echo "new -> $(git remote -v)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment