Bash/Git - Prompt User for Password Issue

Viewed 40

I've made a bash script that automates a git commit to a remote. However, when it gets to the commit it doesn't pass the SSH key password prompt to the user, it just exits.

Here's the relevant part of the script!

set -e

[...]

read -p "Would you like to upload your app now? [y/n]: " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    exit 1
fi

git add *
git commit -m "Commit (Automated)"
git push cloud master

Not really a shell script person, so any help would be much appreciated!

EDIT: to clarify I want the user to be prompted to enter their password at "git push..."

1 Answers

Solved! Looks like the "set -e" at the top of my script was the culprit. It saw the git commit commands "Everything is up-to-date" response as a command failure and exited. Removing it solved the issue :D

Related