Last active
September 19, 2018 21:22
-
-
Save moisespsena/1ab259a7845e414664e7ea7952e4ba1e to your computer and use it in GitHub Desktop.
Convert HTTPS github origin url to SSH in GOPATH
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
#!/bin/bash | |
if [ "$1" != '' ]; then | |
cd "$1" || exit $? | |
fi | |
find `pwd` -name .git -type d | while read l; do | |
perl -i -pe 's/https:\/\/github.com\/([^\/]+)\/(.+?)(\.git)?$/git\@github.com:\1\/\2.git/' "$l/config" && dirname "$l" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment