Git.php | A PHP git library - A PHP git repository control library
kandi X-RAY | Git.php Summary
kandi X-RAY | Git.php Summary
A PHP git repository control library. Allows the running of any git command from a PHP class. Runs git commands using proc_open, not exec or the type, therefore it can run in PHP safe mode.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Set the git repository path
- Run a command .
- Create a new Git repository .
- Log a diff
- Get the Git directory path .
- Clone a remote repository .
- Set the path to the binary file .
- Open git repo .
- Create a new GitRepository instance .
- Check if variable is a repo
Git.php Key Features
Git.php Examples and Code Snippets
Community Discussions
Trending Discussions on Git.php
QUESTION
i'm stuck for two days now on the same issue.
I'm trying to create a commit and push it to my remote repository using shell commands throw with PHP.
I'm able to do a git add or a git commit but not a git push. When I try to use stream_get_contents
on the pipe opened by proc_open('git push [...]');
, it does an infinite loop and I can't see any result or errors ...
I tried to put a timeout or set non-blocking mode but nothing change in the execution. I also tried to print the user with whoami
and I get 'nt authority\system' but I don't know what to do with that.
After looking for many PHP forums and libraries on GitHub or GitHub API, I didn't find any solution who works for me (maybe I did them wrong?).
Here somes links who I have looked:- Running git pull from a php script (I'm on Windows OS not linux)
- https://github.com/mikehaertl/php-shellcommand (Infinite loop too)
- https://github.com/kbjr/Git.php (Infinite loop too)
- https://docs.github.com/en/rest/reference/repos#contents (Can upload or modify a file in a repo but not an entiere commit)
- https://github.com/mikehaertl/php-shellcommand/issues/20#issuecomment-521752406 (Infos ...)
- Git (v2.24.1.windows.2)
- PHP (v7.4.0)
- Wamp Server (v3.2.0)
- Windows (v10.0.18363.1082)
ANSWER
Answered 2020-Sep-29 at 08:09A few weeks later, I finally found the source of the problem. It was not proc_open but stream_get_contents that blocked me. When I done a git push, my system ask me for enter my git's username and password but executed by PHP, I don't have a terminal instance to put my values so stream_get_contents still wait to an entry who never comes.
I used git config
to set my repo credentials and then it works !
QUESTION
Anyone of you already use this Git.ph? I'm having a hard time to setup this in my project. Already tried $repo = Git::open('https://github.com/cristianumali22/Test-Project.git');
but the output is "https://github.com/cristianumali22/Test-Project.git" does not exist
Is it possible to integrate this to Github or Gitlab? Thank you!
ANSWER
Answered 2020-Jan-29 at 06:39Git can only work with repositories available at the local filesystem. Repositories at remote URLs are contacted to clone/fetch/pull/push and nothing more. SO you have to clone a repository locally and open it with $repo = Git::open('/path/to/repo');
Gitlab/Github/Bitbucket have API that extend git and allow to work with remote repositories but the library cannot use that API so you only can use local clones.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Git.php
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page