Created
March 17, 2022 16:41
-
-
Save burmudar/fd458e2a5405c1c0b2840e70f067f7ea to your computer and use it in GitHub Desktop.
Update repo origin
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 | |
| USERNAME="Burmudar" | |
| NEW_USERNAME="burmudar" | |
| SRC="~/development" | |
| for dir in $(fdfind -H -t d -d 2 -p ".git" $SRC) | |
| do | |
| cd $dir | |
| url=$(git remote get-url origin) | |
| if [[ $url =~ "Burmudar" ]]; then | |
| echo "--- $dir ---" | |
| repo=$(echo $url | sed "s/$OLD_USERNAME/$NEW_USERNAME/g") | |
| echo "updating repo: $repo" | |
| git remote set-url origin $repo | |
| echo $(git remote get-url origin) | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment