3

I was trying to auto deploy code on server but I am getting below error in webhook log:

repository access denied. deployment key is not associated with the requested repository. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I have already add my server public SSH key to the BitBucket and it's working fine if i run 'git pull' command in project directory.

I have set webhook as follow in BitBucket:

URL: http://IP-address/project-folder/hook/deploy.php

Status: Active (checked)

SSL / TLS: Skip certificate verification (checked)

Triggers: Repository push (selected)

deploy.php:

<?php
echo shell_exec("git pull 2>&1");

After commit / push code locally I got above error in webhook log.

Can anyone help me to resolve this issue? Any help would be appreciated.

Maulik Savaliya
  • 1,262
  • 7
  • 17
Milan
  • 631
  • 1
  • 5
  • 21
  • 2
    Probably because your php application is running under a different user that doesn't have necessary git/ssh environment variables/keys. – Himal Oct 26 '18 at 13:50
  • 2
    Try using the `GIT_SSH_COMMAND` where you explicitly specify the key to use, should help with debugging. – Optimae Oct 26 '18 at 14:42

0 Answers0