Last active
December 6, 2020 18:50
-
-
Save pollend/6680caffe1f9cf81203f537adadef8b3 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
org="" | |
tg="" | |
for i in */; do | |
tg="$(git -C "$(pwd)/$i" remote -v | grep origin | grep "(fetch)" | sed -s 's/origin//g' | sed -s 's/(fetch)//g')"; | |
if [[ $tg == *"http"* ]]; then | |
org="$(echo ${tg} | sed -s 's/https:\/\/github.com\//git@github.com:/g')"; | |
git -C "$(pwd)/$i" remote remove origin | |
git -C "$(pwd)/$i" remote add origin "${org}" | |
echo "${org}"; | |
fi; | |
echo ${tg} | |
done; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment