peter-murach/github — Issue #4: GitHub::GitData#create_tree seems not to work
Author: reedlaw
Created: 2011-12-30 21:26:04+00:00
State: open

This is not working:

github = Github.new(oauth_token: "XXXX")
user = github.users.get_user
sha = github.git_data.create_blob user.login, 'test', "content" => Base64.encode64(params[:content][:blob_content][:value]), "encoding" => "base64"
tree = github.git_data.create_tree user.login, 'test',
"tree" => [
{
"path" => params[:path],
"mode" => "100644",
"type" => "blob",
"sha" => sha.sha
}
]

I get this:

post https://api.github.com/repos/reedlaw/test/git/trees
Accept: "*/*"
User-Agent: "Github Ruby Gem 0.3.6"
Content-Type: "application/x-www-form-urlencoded"
Github::ResourceNotFound Exception: POST https://api.github.com/repos/reedlaw/test/git/trees?access_token=XXXX: 404{"message":"Not Found"}

But it works fine with curl:

$ curl -d '{"tree":[{"path":"test.txt","mode":"040000","type":"tree","content":"testing"}]' -H "Authorization: token XXXX" https://api.github.com/repos/reedlaw/test/git/trees
{
"tree": [
{
"type": "blob",
"sha": "9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666",
"size": 7,
"url": "https://api.github.com/repos/reedlaw/test/git/blobs/9a2c7732fab5bcd73ea3ed52d2d9599a4cc47666",
"path": "test.txt",
"mode": "100644"
}
],
"sha": "df141fba3a315257afbdcac13406ef049106d9bb",
"url": "https://api.github.com/repos/reedlaw/test/git/trees/df141fba3a315257afbdcac13406ef049106d9bb"
}