Skip to content

GithubAPI: Uploading File

peter-murach edited this page Apr 15, 2012 · 2 revisions

Setup github instance:

github = Github.new oauth_token: '...'

Create a new download resource:

res = github.repos.create_download 'username', 'reponame',
  'name': 'droid10', 
  'size': File.size('path_to_file.jpg'),
  'content_type': 'image/jpeg'

and then use the response object and given file path to upload it to amazon s3:

github.repos.upload res, 'path_to_file.jpg'
Clone this wiki locally