From b15e00731a4cf2d2b427a7e39181092b3e31251e Mon Sep 17 00:00:00 2001 From: Eshan Roy Date: Wed, 20 Nov 2024 01:58:41 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=5Fblank):=20minimal=20scrip?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.sh | 48 +++++++++++------------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/config.sh b/config.sh index d387897..eb4e6d9 100644 --- a/config.sh +++ b/config.sh @@ -5,43 +5,17 @@ # NOTE : Run at your own Risk! -# Function to print GitHub credential configuration options -print_options() { - echo "🔒 Configure GitHub Credentials:" - echo "1. 📝 Enter GitHub username and password" - echo "2. 🔑 Enter GitHub personal access token" - echo "3. 📁 Use existing GitHub credentials from ~/.gitconfig" -} +# Prompt user for GitHub username +read -p "Enter your GitHub username: " GITHUB_USERNAME -# Print options and prompt user to select -print_options -echo "Enter the number of your chosen option:" -read -r OPTION +# Prompt user for GitHub email +read -p "Enter your GitHub email: " GITHUB_EMAIL -# Handle user selection -case $OPTION in - 1) - echo "Enter your GitHub username:" - read -r USERNAME - echo "Enter your GitHub password:" - read -s PASSWORD - git config --global credential.helper store - git config --global credential.username $USERNAME - git config --global credential.password $PASSWORD - ;; - 2) - echo "Enter your GitHub personal access token:" - read -r TOKEN - git config --global credential.helper store - git config --global credential.username "your-github-username" - git config --global credential.password $TOKEN - ;; - 3) - echo "Using existing GitHub credentials from ~/.gitconfig" - ;; - *) - echo "Invalid option. Exiting." - exit 1;; -esac +# Set the global Git configuration for username and email +git config --global user.name "$GITHUB_USERNAME" +git config --global user.email "$GITHUB_EMAIL" -echo "GitHub credentials configured successfully! 👍" \ No newline at end of file +# Confirm the changes +echo "GitHub username and email have been configured:" +git config --global user.name +git config --global user.email