1

If I push to my remote origin repository the post-receive hook should push all to another remote repository on another machine.

When I push to my origin the post-receive hook gets triggered but I always get the following error message.

remote: post-update started remote: Host key verification failed. remote: fatal: Could not read from remote repository. remote: remote: Please make sure you have the correct access rights remote: and the repository exists. remote: post-update end

Content of post-receive hook:

#!/bin/sh
echo "post-update started"
git push --mirror git@<server IP>:root/sample.git
echo "post-update end"

I have created a ssh key for my normal user and git user and both were added to authorized keys file.

Something must be missing , but I do not know what?!

1 Answer 1

0

The SSH error suggests that the fingerprint of the server's key hasn't been imported in the .ssh/known_hosts file yet. You can do this by running ssh git@<server IP> manually as the git user on the git server once.

Alternatively you can tell SSH not to check the host key by using the following ssh options:

UserKnownHostsFile=/dev/null
StrictHostKeyChecking=no

You can add these in your .ssh/config file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .