Github API创建提交 [英] Github API create commit

查看:311
本文介绍了Github API创建提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关Github API的帮助,

I need help with Github API,

我需要通过api提交新版本的文件,我正在尝试通过向

I need commit new version of file through api, I'm trying to achieve this by sending post request to

https://api.github.com/repos/:username/:repo:/git/commits/

有数据

{
    "login": "username",
    "token": "auth_token",
    "parent_commit": "sha",
    "message": "commit message.",
    "content": {
        "path": "full/path",
        "mode": "edit",
        "data": "new content"
    }
}

但是它失败并显示结果-找不到.

But it fails with result - not found.

有没有人知道将请求发送到哪里以及这种格式是否正确?

Have anyone idea where to send this request and if this format is right?

(格式由- http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html )

谢谢!

推荐答案

我也对此感到困惑!

提交新内容实际上是使用其低级功能强大的API的多步骤过程.

Committing new content is actually a multi-step process, using their low level and powerful API.

这里是我分享一个解决方案的要点.注意,有些东西是硬编码的,例如分支名称"master".

Here is a gist I made to share one solution. Note that a few things are hard coded, like the branch name "master".

请随时拨叉并改善要点,如果您无法正常运行,请告诉我.

Please feel free to fork and improve the gist, or let me know if you're having trouble getting this to run.

这篇关于Github API创建提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆