Last active
November 26, 2020 23:04
-
-
Save salkin-mada/3f69c659df2718b1a30979eccee063ad to your computer and use it in GitHub Desktop.
ssh-ify https clones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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