如何使用CURL上传github资产文件 [英] How to upload github asset file using CURL

查看:139
本文介绍了如何使用CURL上传github资产文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的桌面上名为 hello.txt的文件上传到具有发布版本的git存储库中。我该怎么做呢?我阅读了git文档,但它说的像是这样:

I want to upload a file on my desktop called 'hello.txt' to my git repository which has a release. How do I do this? I read the git documentation but it says something like :

POST https://< upload_url> / repos /:owner /:repo / releases /:id / assets?name 。如何在CURL中执行此操作。我不明白。

POST https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name. How to do this in CURL. I did not understand this.

如何将此文件作为发布资源发布到我的github版本中?谢谢

How to post this file as a release asset to my github release? Thanks

推荐答案

curl \
    -H "Authorization: token $GITHUB_TOKEN" \
    -H "Content-Type: $(file -b --mime-type $FILE)" \
    --data-binary @$FILE \
    "https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=$(basename $FILE)"



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