From 21e63d5f560956cfb94e5e2172bfbcd6d8a9f2a8 Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Wed, 20 Jul 2022 07:33:26 -0700 Subject: [PATCH] :recycle: Refactored error handling message for gh pat --- scripts/bgit | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/bgit b/scripts/bgit index a0840783..a91bc03a 100755 --- a/scripts/bgit +++ b/scripts/bgit @@ -139,7 +139,13 @@ if [ $numrepos -eq 0 ] ; then if [[ -n $host && $host="github.com" ]] ; then read -e -r -p "${txtwhite}Host site is github.com, would you like bgit to create the repository?: " crepo - # if $HOME/.gh_pat doesn't exist, then exits with bash error + # if $HOME/.gh_pat doesn't exist, then exits + if [[ ! -f $HOME/.gh_pat ]]; then + echo "${txtred}Github personal access token doesn't exist" + echo "See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token${txtwhite}" + exit 1 + fi + source $HOME/.gh_pat if [[ $crepo == 'y' || $crepo == 'yes' ]] ; then