Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass password to deploy.sh? #27

Closed
btimofeev opened this issue Sep 18, 2017 · 5 comments
Closed

How to pass password to deploy.sh? #27

btimofeev opened this issue Sep 18, 2017 · 5 comments
Labels

Comments

@btimofeev
Copy link

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?

@masasam
Copy link
Owner

masasam commented Sep 18, 2017

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.

@btimofeev
Copy link
Author

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.

@masasam
Copy link
Owner

masasam commented Sep 18, 2017

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.

@masasam masasam closed this as completed Sep 24, 2017
@cescoferraro
Copy link
Contributor

cescoferraro commented Sep 24, 2017

@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

@masasam masasam reopened this Sep 24, 2017
@masasam
Copy link
Owner

masasam commented Sep 24, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants