I'm setting up a hook between Github and my server, which can auto pull new commits when the script triggered by Github requests.
It's all setting finished, like ssh-keys, git origin. I can pull a new commit from my private repo hosted on Github by running
git pull origin master
Host key verification failed. fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
shell_exec("cd /var/www/html/tinfo/; git pull origin master 2>&1;");
This problem solved with adding GitHub to known hosts according to Benyi's comment.
ssh-keyscan -t rsa github.com >> /var/www/.ssh/known_hosts
You should specify ssh key firstly. After that, you should do git tasks what you want.
1-) Ssh keys are not user specific. So you can create rsa key pair everywhere. Public key should be copied to github. Private key should be placed on your host.
2-) In linux environment, default
.ssh folder path is under the users home directory. If you do not specify user's home folder, it should be in
/home/www-data/.ssh. If you can not access this folder you should specify your ssh key that have written in my example.
3-) In linux environment,
deploy.php runned by user who executing
nginx process. Commonly
nginx processes executed by
4-) You should specify your ssh key path for sending this key file for authorization when you talk with github server.