0

I have a problem executing a git clone on a Minimac 10.8.5.

If I execute the command from a shell, it works. If I execute the same command from a php file (through a button press on a web page), I get

"error: ssl peer certificate or ssh remote key was not ok while accessing...".

Already executed: git config --global http.sslVerify = false

Already changed the User and Group of the file /etc/apache2/httpd.conf

Tried to execute it with a git clone --verbose

The only error I see is the above one, no more informations. Where or how can I find a more detailed log ?

What could be the cause ?

marco
  • 1,686
  • 1
  • 25
  • 33

3 Answers3

0

This look that the remote requires an authentication either through a ssh key like heroku an github or with an password via https.

In both cases you will need this, you can configure your system first and then try to run the git via php.

I believe that you are doing some type of deploy script right? If so you may want consider use git pull on the after the first deploy.

ooredroxoo
  • 290
  • 4
  • 7
  • I am cloning from local – marco Mar 07 '14 at 13:54
  • Can you send the entire command used that is getting this error? – ooredroxoo Mar 07 '14 at 17:01
  • This is the system: The Safari browser on a Minimac 10.8.5 executes a php on a button press. The php calls a python with the following command: $output = shell_exec('cd /Users/user/gitroot/host && /usr/bin/python /Users/user/gitroot/host/buildAll.py --date ' . $date . ' --hostdest "/Users/user/builds" --guestdest "E:" --branch ' . $_GET['branch'] . ' > /dev/null 2>/dev/null & '); – marco Mar 10 '14 at 06:45
  • The python calls other 2 python importing the scripts and calling buildOnHost.main(argv) and buildOnGuest.main(argv). I am interested in buildOnHost now as buildOnGuest works. "On host" means that the machine builds locally and clones from the same machine. The strange thing is that if I execute "print 'user: ' + os.environ['USER']" on the first python, it prints the correct user. If I execute it on the second python, it crashes (or at least it stops executing with no logs). – marco Mar 10 '14 at 06:46
  • my fault, also on the first python the USER env variable is empty. – marco Mar 10 '14 at 08:03
0

Edit: solved in another way. The only way I've found to create a shell with the correct user, is starting the process via ssh. So I do the following and all works as expected.

<?php
    $cmd = "ssh user@localhost <cmd to execute>";
shell_exec($cmd);
?>
marco
  • 1,686
  • 1
  • 25
  • 33
0

Try this

env GIT_SSL_NO_VERIFY=true git pull origin master
Garreth McDaid
  • 2,427
  • 22
  • 34
  • I've written: "Already executed: git config --global http.sslVerify = false" that should do the same – marco Mar 10 '14 at 11:37