diff options
author | typebrook <typebrook@gmail.com> | 2020-05-04 10:01:54 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-05-04 10:01:54 +0800 |
commit | d0523bc742f7f3ff048939644e5e173757d68143 (patch) | |
tree | 9704ead2061623da49b1cfd83db751852275674e | |
parent | a595e7c066c9b2700e5323f41f0a6af8eea68887 (diff) |
update
-rwxr-xr-x | tools/swap-protocol.bash | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/swap-protocol.bash b/tools/swap-protocol.bash index 00b6b4e..b7f4db2 100755 --- a/tools/swap-protocol.bash +++ b/tools/swap-protocol.bash | |||
@@ -13,9 +13,11 @@ git remote -v \ | |||
13 | 13 | ||
14 | if [[ $url =~ git@.*github.com ]]; then | 14 | if [[ $url =~ git@.*github.com ]]; then |
15 | target=${target:-https} | 15 | target=${target:-https} |
16 | # git@ -> https:// | ||
16 | [[ $target == https ]] && sed -E 's#^git@(.+):(.+)$#https://\1/\2#' <<<$url | xargs git remote set-url $extra $remote | 17 | [[ $target == https ]] && sed -E 's#^git@(.+):(.+)$#https://\1/\2#' <<<$url | xargs git remote set-url $extra $remote |
17 | elif [[ $url =~ https://.*github.com ]]; then | 18 | elif [[ $url =~ https://.*github.com ]]; then |
18 | target=${target:-git} | 19 | target=${target:-git} |
20 | # https:// -> git@ | ||
19 | [[ $target == git ]] && sed -E 's#^https://([^/]+)/(.+)$#git@\1:\2#' <<<$url | xargs git remote set-url $extra $remote | 21 | [[ $target == git ]] && sed -E 's#^https://([^/]+)/(.+)$#git@\1:\2#' <<<$url | xargs git remote set-url $extra $remote |
20 | fi | 22 | fi |
21 | done | 23 | done |