CodeIgniter Forums
Using CI3 to push to a Github repo - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Using CI3 to push to a Github repo (/showthread.php?tid=67278)



Using CI3 to push to a Github repo - opcode - 02-03-2017

Does anyone know how to push commits to a Github repo from inside CodeIgniter? 

I have an upload form and once the file is uploaded I want to trigger:

git add -A
git commit -m "some message"
git push origin master

I have tried using this library: https://github.com/kbjr/Git.php

I split it into two classes and put then in /libraries and used $this->load->library()
to load them, but when I run a test with this:

$dir = base_url() . '/uploads';
$repo = Git::open($dir);

$repo->add('.');
$repo->commit('Some commit message');
$repo->push('origin', 'master');

I get the error:  Message: "http://xxx.com/uploads/" does not exist

Any other ideas?


RE: Using CI3 to push to a Github repo - opcode - 02-03-2017

I was able to get the above library to find the repo on my server but I cannot get push command to work due to permissions. I assume that because my web user is apache and my ssh in /.ssh on my server is owned by root, that this is the issue. How do I resolve this though? apache doesn't really have a home directly as it isn't a normal user, so i can't create an SSH key for it, can I?