masasam/emacs-easy-hugo

How to pass password to deploy.sh?

btimofeev opened this issue · 5 comments

Hello.

I have a blog on the github pages and I use this script for deployment:

#!/bin/bash

echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
hugo 

cd public
git add -A

msg="rebuilding site `LANG=C date`"
if [ $# -eq 1 ]
  then msg="$1"
fi
git commit -m "$msg"

git push origin master

cd ..

In the script git push command prompts for a ssh password in the console, but easy-hugo not request a password and therefore no changes are made to the server.

Is it possible to somehow request a password inside easy-hugo when deploying?

Hi @btimofeev .
Thank you for report.

Since I connect to GitHub with SSH (see https://help.github.com/articles/connecting-to-github-with-ssh/) and I use keychain (see http://www.funtoo.org/Keychain), No password is required.

If you pass passwords with shellscript you'd better use expect.
See https://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command.

Thank you for response. Keychain works, but maybe this will not work if you restart the computer and deploy the site without opening the terminal before that.

I found some information on how to work with passwords at the bottom of this page, maybe this will help for future releases.

Hi @btimofeev .
Thank you for response.
When I actually run it now, this work if I restart the computer and deploy the site without opening the terminal before that.

@btimofeev
https://stackoverflow.com/questions/11403407/git-asks-for-username-every-time-i-push

$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>

Do this once then git wont ask for credential ever again on the machine you typed this

Hi @cescoferraro .
I didn't know git credential caching.
It seems like this can also be used for password escape.
Thank you for your advice.