Executing git commands via PHP

后端 未结 4 1706
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 14:33

How can git commands like git add . and git commit -m be executed using php?

It is for a project that creates a centralized repository faci

4条回答
  •  日久生厌
    2020-12-03 14:52

    It is definetly possible. I implemented it in one of my projects. However you should be careful about permissions.

    On linux, usually, the exec command will execute using the www-data user. So you should allow www-data to write and read on your work directory.

    One quick and dirty way to do it is : chmod o+rw -R git_directory

提交回复
热议问题