Nuengnapa Nuengnapa -4 years ago 229
PHP Question

how to commit github using php

I would like to add and commit to local git repository using PHP code

I new babies in github ,so I don't understand in path on github
path git.exe at C:\Users\Administrator\AppData\Local\GitHub\PortableGit_054f2e797ebafd44a30203088cd3d58663c627ef\libexec\git-core

path of repo

$path = "C:\Users\Administrator\Documents\GitHub\confre";
echo shell_exec("git add . ");
echo shell_exec("git commit -m 'commit form php' ");

it don't work. Help me pls


Answer Source

I use it work!

$repo = Git::open('gitphp');  // -or- Git::create('/path/to/repo')
$repo->run(' config "your email"'); 
$repo->run(' config "your username"');   
echo $repo->run(' log -p'); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download