diff options
author | Toby Vincent <tobyv13@gmail.com> | 2021-07-01 17:27:35 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2021-07-01 17:27:35 -0500 |
commit | c265c6798cfcd22c3b1ad57ca2ab82e0f3d9766f (patch) | |
tree | 7774040ac2fc87b9bb2b5dbdcf1cc75bbe466a99 /scripts | |
parent | dd47cf5ed102d75fefe08588dad5ad6554478e2e (diff) |
feat: unified input for remote repo
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/git-split.sh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/scripts/git-split.sh b/scripts/git-split.sh index 94ac38f..06e6c8c 100755 --- a/scripts/git-split.sh +++ b/scripts/git-split.sh @@ -72,7 +72,7 @@ while true; do shift ;; -r | --remote) - REMOTE="$2" + REMOTE="$(basename $(dirname ${2#"git@github.com:"}))/$(basename ${2#"git@github.com:"})" shift 2 ;; --public | --private) @@ -107,7 +107,7 @@ git init && git pull $REPO $DIRECTORY && git branch -M main files=(".gitignore" ".gitattributes" ".vscode" "LICENSE") for f in "${files[@]}"; do - if [ ! -e "./${f}" && -e "${REPO}/${f}" ]; then + if [[ ! -e "./${f}" && -e "${REPO}/${f}" ]]; then printf '%s\n' "Copying ${f} to new repository..." cp -r "${REPO}/${f}" ./ fi @@ -120,14 +120,11 @@ if command -v gh &>/dev/null; then yes "n" | gh repo create --confirm "${REMOTE}" "${VISIBILITY}" else printf '%s\n' 'gh cli tool could not be found. Explicitly adding git remote to your local repository.' + git remote add origin https://github.com/${REMOTE} fi -if git ls-remote git@github.com:${REMOTE} &>/dev/null; then - git push -u origin main -else - printf '%s\n' 'Remote repository not found.' -fi +git push -u origin main if [ $? -ne 0 ]; then printf '\n%s\n' 'Verify/create the remote repository and push to it with the following command: ' |