【发布时间】:2013-03-30 05:14:42
【问题描述】:
嗨,我正在使用 GitHub v3,我想在 repo 中添加新的二进制文件。通过使用 KnpLabs php-github-api,我完全按照中所说的进行
- 获取当前提交对象
- 检索它指向的树
- 检索树针对该特定文件路径具有的 blob 对象的内容
- 以某种方式更改内容并使用该新内容发布新的 blob 对象,从而获得 blob SHA 回复
- 发布一个新的树对象,将文件路径指针替换为新的 blob SHA 获取树 SHA 回复
等等。但在 5 点上我得到了一个例外
server error
形成这个代码
$comit=$client->api('git')->commits()->show($userName,$reposit,'master');
$basetree=$client->api('git')->trees()->show($userName,'appwiz',$comit['commit'] ['tree']['sha']);
$newBlob=$client->api('git')->blobs()->create($userName,$reposit,array('content'=> "gitapi",'encoding'=>'base64'));
$client->authenticate($userName,$password,Github\Client::AUTH_HTTP_PASSWORD);
$treeData = array(
'tree'=>
array( array('path'=>'/'
,'mode'=>'040000'
,'type'=>'tree'
,'content'=>'folder')
)
);
【问题讨论】:
标签: php api github github-api