【问题标题】:Upload a file to my github repo from postman从邮递员上传文件到我的 github 仓库
【发布时间】:2017-10-21 00:40:11
【问题描述】:

我想从 Postman 上传一个文件到我的 Github 存储库。我试过的是:

  1. 从 PAT 生成令牌:https://github.com/settings/tokens
  2. 方法PUT URL:https://github.com/username/test2/info/lfs/objects/cd00e292c5970d3c5e2f0ffa5171e555bc46bfc4faddfb4a418b6840b86e79a2
  3. 正文是一个 1 MB 的文件。

我收到以下错误:您的浏览器发生了意外。如果问题仍然存在,请与我们联系。

【问题讨论】:

    标签: github postman


    【解决方案1】:

    根据API Reference,您不能简单地将文件PUT 指向该URL。相反,您需要将文件编码为 Base64,并将其放入具有以下输入的 JSON 对象中:

    {
      "message": "my commit message",
      "committer": {
        "name": "Scott Chacon",
        "email": "schacon@gmail.com"
      },
      "content": "bXkgbmV3IGZpbGUgY29udGVudHM="
    }
    

    【讨论】:

    • @ParinSanghavi 看看这个-stackoverflow.com/questions/201479/…
    • 你能用步骤解释整个过程吗?我可能应该在某个时候学习 REST。
    • @ParinSanghavi 你的意思是在 Base64 中编码?还是上传文件到github?
    • @ParinSanghavi 您需要从数据文件 (getpostman.com/docs/postman/collection_runs/…) 中读取数据,使用 Javascript 对其进行 base64 编码,然后使用我上面描述的 JSON 格式 PUT 它。跨度>
    猜你喜欢
    • 2022-11-27
    • 2021-10-13
    • 2020-02-21
    • 2018-10-22
    • 1970-01-01
    • 2016-10-24
    • 1970-01-01
    • 2011-10-19
    • 2019-06-07
    相关资源
    最近更新 更多