Reputation: 850
$commitMessage = 'Auto commit from admin panel '.date('d.m.Y H:i:s', time());
chdir(__DIR__.'/../../../..');
$res[] = shell_exec('git add --all 2>&1');
$res[] = shell_exec('git commit -a -m "'.$commitMessage.'" 2>&1');
$res[] = shell_exec('git push origin master 2>&1');
$res[] = shell_exec('git status 2>&1');
Output after git push command: Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
But before i run follow commands:
sudo -u www-data ssh-keygen -t rsa
sudo chown www-data:www-data -R ~/.ssh/known_hosts
sudo chown www-data:www-data -R /project
(where locate .git directory)
After I add ssh key to bitbucket ssh keys (not for deploying).
Upvotes: 1
Views: 2313
Reputation: 789
This error means that the host key for the domain you're connecting to (bitbucket, I assume, from your comment) has changed. It's their key that's different, not yours.
I'd check to see if they've changed their host key recently, and, if they have, you can remove the old key with
$ ssh-keygen -R bitbucket.org
Be careful though, an unknown host key could mean a man-in-the-middle attack. So be sure it's really bitbucket's key before doing this.
Upvotes: 1