Well for sudo password you can simply execute the script with sudo prefix and it will ask for password and it will not ask for password for any sudo commands within the file.
Update
If you want to specify password for authentication to some application like mysql, git etc. Then you have to follow the proper syntax for that specific application. Eg: to take backup of mysql database through bash file. you can use the following command
mysqldump -u root -p "YOUR_SECRET_PASS" "DB_NAME"
Similarly for git you need to find out how it takes the password non interactively. Therefore the syntax to specify password will varies application to application. Consider the following solution in case of git. This will save credentials once it for all.
git config remote.origin.url https://{USERNAME}:{PASSWORD}@github.com/{USERNAME}/{REPONAME}.git
echo "mypass" | sudo -S whoami
. – Adam D. Sep 05 '19 at 13:04