So I've setup a git pull
Webhook from my server.
When I run a test I'm ending with :
Host key verification failed. fatal: The remote end hung up unexpectedly
However I have a ssh-key well inserted since I can git pull
from the directory.
Edit :
Okay so I think it is due to apache user problem.
I tried to sudo -u www-data git pull origin master
but I have the following error :
Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts).
With those permission :
root@vps362370:/var/www/.ssh# ls -al
total 16
drwxr-xr-x 2 777 root 4096 Feb 3 14:58 .
drwxr-xr-x 3 root root 4096 Feb 3 10:06 ..
-rw------- 1 777 root 1675 Feb 3 14:48 id_rsa
-rw------- 1 777 root 404 Feb 3 14:48 id_rsa.pub
-rw------- 1 777 root 0 Feb 3 14:58 know_hosts
root@vps362370:/var/www/.ssh# cd ../
root@vps362370:/var/www# ls -al
total 12
drwxr-xr-x 3 root root 4096 Feb 3 10:06 .
drwxr-xr-x 14 root root 4096 Feb 3 12:41 ..
drwxr-xr-x 2 777 root 4096 Feb 3 14:58 .ssh
What kind of permission should be set? (I tried 777 or 600 but none seems to work).
Edit 2 :
I've manage to add git to my known host by
usermod -a -G www-data root
Then
chgrp www-data /var/www/.ssh
chmod g+rwxs /var/www/.ssh
chmod 777 /var/www/.ssh/known_host
But now I got :
Permission denied (publickey).
Even after specifically adding my /var/www/.ssh/id_rsa.pub to github deploy key.
My .git/config file :
root@vps362370:/var/Smart-Pix# cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:Smart-Pix/Smart-Pix.git
[branch "master"]
remote = origin
merge = refs/heads/master