Centos – run a script to pull repo. from github without asking me a password

bashcentosgitgithub

I just got a new server for my website, and I'm trying to create a trunk in a folder where i can pull data from github.
That way I can easily get the latest version of the website, and copy the needed files to my www.

Git works fine, but then each time I do a:

git pull origin master

It asks me for a password! I want to be able to update git via a script, or even via PHP later on. So that I can update my server automatically.
I've spend a few hours trying to figure out how to save the password but I couldn't, this is why I need your help.

I have followed a few instructions here:
http://help.github.com/ssh-key-passphrases/
But it didn't work.

I am SSHing from Windows to my machine using Putty. The server is a CentOS.

Now that I have added the script in ~/.bashrc as the tutorial told me to do, each time I connect with Putty I have a new line saying:

Could not open a connection to your authentication agent.

Best Answer

Try using expect. You can automatically supply the password to git through an automation script.

Just make sure your script has tight permissions -having plaintext passwords in scripts is usually Bad Idea™.

Edit:

Since I can't write code properly in the comment section below, you could write something like this:

#!/usr/bin/env expect
set password "<your-password>"
spawn /usr/bin/git pull
expect "<exact passphrase>"
send "$password\r"