php - Git pull from Bitbucket server -


i have problem running git pull php script on remote server. have looked @ lot of different sources make work none works me. have done far:

  • created pub , private key apache:

    mkdir /var/www/.ssh sudo chown -r apache:nobody /var/www/.ssh su - apache -c "ssh-keygen -t rsa"  
  • then have put public key on bitbucket.

  • then run command:

    sudo -u apache git pull  

everything works fine.

after wrote simple sh script call php.

  1. the .sh script:

    #!/bin/sh git pull 
  2. and php script:

    <?php     $cmd="./gitpullsc.sh 2>&1"; echo exec($cmd); ?> 

i run php script web browser , this:

permission denied (publickey).
fatal: not read remote repository.

please make sure have correct access rights , repository exists.

then tried add script whoami (to see if user running php script right one) , apache. ok.

i use red hat linux.

any appreciated :)

update

ok, maybe found problem, still looking solution.

i run again sudo -u apache git pull , getting asked private key passphrase again.

but if run command ssh-add -l get:

2048 ***thenumber** /var/www/.ssh/id_rsa (rsa)

so think fine. problem maybe run ssh agent way:

ssh-agent /bin/bash 

update

yes, problem passphrase prompt. still don't know how fix it, left passphrase blank , works...

i answered similar question. wanted add comment referring answer not have enough points add comment.

the idea use start ssh-agent once , load keys it. later, in .bashrc, update environment variables points same ssh-agent (that has keys).

please @ trying deploy using capistrano ssh-agent on remote machine doesn't keep identity loaded git command fails; why?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -