Created
May 20, 2014 13:00
-
-
Save ten0s/12890cc4a398de8bfbb8 to your computer and use it in GitHub Desktop.
Replace github's https url with ssh
This file contains hidden or 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
function git-sshurl() { | |
local OldUrl=`git remote -v | sed -E -n 's/origin\s*(.*) \(push\)/\1/p'` | |
local NewUrl=`echo $OldUrl | sed -E 's#https://(.*)/(.*)/(.*)#git@\1:\2/\3#'` | |
echo "old url:" $OldUrl | |
echo "new url:" $NewUrl | |
git remote set-url origin $NewUrl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice one thx