Skip to content

Instantly share code, notes, and snippets.

@moisespsena
Last active September 19, 2018 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moisespsena/1ab259a7845e414664e7ea7952e4ba1e to your computer and use it in GitHub Desktop.
Save moisespsena/1ab259a7845e414664e7ea7952e4ba1e to your computer and use it in GitHub Desktop.
Convert HTTPS github origin url to SSH in GOPATH
#!/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