Giter Site home page Giter Site logo

ghup's Introduction

** Note: GitHub has decided to discontinue the downloads **

This is a script which can upload files to github from the commandline.

Installation

First you need to get a oauth token. The token must include either the repo or public_repo scope.

curl -X POST -u <github user>:<github password> \
  -d '{"note":"file upload script","scopes":["repo"]}' \
  https://api.github.com/authorizations

Copy the token from the response and put it into your git config file:

 git config --global github.upload-script-token <the token from the response>

Usage

github-upload.rb <file-name> [<repository>]

The repository parameter is optional. If one is not provided, if inside of a git repository, it will default to the remote named origin. If provided, the parameter should be in the format <github user>/<repo>.

Example

./github-upload.rb bin/sample-app.jar wereHamster/ghup

ghup's People

Contributors

iqandreas avatar jmalak avatar werehamster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ghup's Issues

Add optional certificate verification

I've had a problem when trying to run this if the certificate cant be verified. Now i'm not a ruby expert, but adding the following fixed it for me.

def post(url, token, params, headers)
  uri = URI.parse(url)

  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE

  req = Net::HTTP::Post.new(uri.path, headers)
  req['Authorization'] = "token #{token}" if token

  return http.request(req, params)
end

Addition is the "http.verify_mode = OpenSSL::SSL::VERIFY_NONE" to disable the verification.

Uploads are corrupt

Whenever I upload a file using ghup, the resulting download is shorter than the file I uploaded.

Typo in script

There's a typo in one error message: "doens't" โ†’ "doesn't"

error while uploading

Hi

i was searching for a long time for script as yours. Thank you very much for your efforts on this.

unfortnuately it does not work for me.

i get always the following error:

{"message":"Not Found"}GitHub doesn't want us to upload the file.

message not found comes from "print res.body one line before the error message itself in your script.

any ideas on this?

thx in advance

regex error when anonymous git clone

I try to use this nice script in travis-ci, and noticed there is error in regex parsing since the remote url there is
git://github.com/larrycai/sdcamp

repo = ARGV[1] || `git config --get remote.origin.url`.match(/[email protected]:(.+?)\.git/)[1]

BTW: Now I can give my repo name as input to across this.

Please give an error if Ruby < 1.9 used

At present it fails in a way that's hard to diagnose.

A very simple fix, which gives an obvious error message and has an obvious fix for most users likely to use this script, is simply to change the hash-bang line to:

!/usr/bin/env ruby1.9

Even if there's no ruby1.9 on the user's system with Ruby 1.9 installed, it's obvious what the intention is, and e.g. on my Ubuntu system, I'd just change it to ruby1.9.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.