Reputation: 687
I need a way off avoiding entering my password manually when a git pull command is executed in a build script I have.
I have tried the ssh keygen method and the git credentials caching method but both of them do not work for me.
So is there any way of somehow storing the password in the shell script somewhere, so the password prompt just uses the stored password, instead of waiting for me to enter the password explicitly and hitting enter.
Thanks guys.
Upvotes: 2
Views: 2427
Reputation: 31544
I really think that you should fix the process git ssh keys, but if you really want to automate something, you can always use expect
:
/usr/bin/expect <<EOD
spawn git pull
expect "password:"
send "this_is_my_password_unsafely_stored_in_a_bash_script\r"
interact
EOD
Upvotes: 3
Reputation: 21676
git config --global credential.helper "cache --timeout=2400"
You can change timeout value according to your need.
Also see: Is there a way to skip password typing when using https:// on GitHub?
Upvotes: 0