Welcome Guest, Not a member yet? Register   Sign In
Using CI3 to push to a Github repo
#1

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?
Reply
#2

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?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB