Json GithubAPI创建提交

Json GithubAPI创建提交,json,api,http,github,commit,Json,Api,Http,Github,Commit,我需要Github API的帮助 我需要通过api提交文件的新版本,我正试图通过向发送post请求来实现这一点 https://api.github.com/repos/:username/:repo:/git/commits/ 有数据 { "login": "username", "token": "auth_token", "parent_commit": "sha", "message": "commit message.", "content":

我需要Github API的帮助

我需要通过api提交文件的新版本,我正试图通过向发送post请求来实现这一点

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"
    }
}
但是它失败了,结果是找不到

有人知道在哪里发送此请求以及此格式是否正确吗

(格式灵感来自-)


谢谢大家!

我也对这件事感到困惑

提交新内容实际上是一个多步骤的过程,使用它们的低级别和强大的API

下面是我要分享的一个解决方案。注意,有一些东西是硬编码的,比如分支名称“master”


请随时提供并改进要点,或者如果您在运行此程序时遇到问题,请告诉我

请注意,自2013年5月以来,您有:

这包括

(内容为更新的文件内容,Base64编码。)

{
  "message": "my commit message",
  "committer": {
    "name": "Scott Chacon",
    "email": "schacon@gmail.com"
  },
  "content": "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz",
  "sha": "329688480d39049927147c162b9d2deaf885005f"
}