Last active
January 2, 2016 09:59
-
-
Save Drarok/8286352 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 | |
# Convert 'http://github.com/user/repo' remotes to 'git://github.coim/user/repo'. | |
for GIT_DIR in $(find . -type d -name '.git'); do | |
export GIT_DIR | |
CURRENT_URL=$(git config --get remote.origin.url); | |
NEW_URL=$(echo $CURRENT_URL | sed 's/^http:/git:/'); | |
NEW_URL=$(echo $NEW_URL | sed 's/^https:/git:/'); | |
if [ "$CURRENT_URL" != "$NEW_URL" ]; then | |
echo "${GIT_DIR}: Changing URL from ${CURRENT_URL} to ${NEW_URL}"; | |
git config remote.origin.url "$NEW_URL"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment