Webhook pull git failed

Hello,

I’m having problems with setting up my webhook. I want my system to update the website when somebody pushes his/her files to git.

Our idea is that the webhook sends a request to the trigger file (php file). de trigger file ask for a pull request & it will be updated. We are trying to do it with ssh. Like:

cd ‘/route/to/your/git’ && git pull git@hosturl master 2<&1

But i am getting errors the whole time. (Host key verification failed. fatal: The remote end hung up unexpectedly)

but if i do:

cd ‘/route/to/your/git’ && git pull http://username:password@hosturltogit master 2<&1

It will work perfect but the security is bad because i am showing my password.

I would be glad, if somebody can help me. Thanks!

Is the .ssh/conf setup for the user that the webhook is running?
Try to su to that user and do the git pull to make sure it works.

The webhook user has sudo rights but it still doesn’t work.
If the webhook does ‘sudo git pull git@hostname master 2<&1’ it will get:

‘Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly’

But if I log in as root and do ‘git pull git@hostname master 2<&1’ it works fine.

Can you try doing a “whoami” to find which user the script is being executed?
Permission denied seems to suggest there’s a problem with doing a “sudo”.