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

查看:45
本文介绍了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)

(Format is inspired by - 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天全站免登陆