Programmatically add files to a GitHub download page

前端 未结 4 1630
被撕碎了的回忆
被撕碎了的回忆 2021-02-18 22:57

[[Please note that Github has changed a lot since this question was first asked; instead of \"download page\" read \"new release\".]]

I generate PDF documentation as par

相关标签:
4条回答
  • 2021-02-18 23:01

    I take it that by "GitHub download page", the owner means a repo–more specifically a branch– that can be downloaded via the "download" button.

    If you want to add a file to a repo using the API, you will have to become familiar with the process described here: https://developer.github.com/v3/git/

    It's not the easiest process in the world, but mastering it will force you to understand the concepts of blobs, trees, commits and references, amongst others.

    You can't just "send a file" to a repo because you're working with Git, and Git has some "internal expectations" that you just can't ignore (it's impossible to think of GitHub as some sort of host that you can ftp). Explaining the flow required to create a file in a GitHub repo is certainly beyond the scope of the original question, but to provide a clear answer: no, it's not possible to programmatically upload a file on GitHub, but yes it is possible to programmatically push a file on GitHub".

    There's a PHP library named GitHubTreePHP that lets you automate the process (Disclaimer: I wrote it).

    0 讨论(0)
  • 2021-02-18 23:05

    The GitHub blog post announcing that this feature has been disabled: https://github.com/blog/1302-goodbye-uploads

    0 讨论(0)
  • 2021-02-18 23:09

    check out for net-github-upload which is available

    for perl: http://github.com/typester/net-github-upload-perl and ruby: http://github.com/Constellation/ruby-net-github-upload

    With that you can write a small script to upload and update your PDF easily. To sad there's no easy way provided by github guys themselves..

    cheer!

    0 讨论(0)
  • 2021-02-18 23:25

    Github API v3 supports this feature.

    GitHub also provides a maven plugin based on the java API that is part of the Eclipse Mylyn connector for GitHub.

    There is a ruby gem called github_api.

    The other answer talks about net-github-upload which is available for perl and ruby.

    0 讨论(0)
提交回复
热议问题