使用Github API为Github仓库创建Webhook

3
我正在尝试使用githubapi为GitHub存储库创建Webhook,为此我正在使用Github_api gem。 我编写了用于创建钩子的POST请求。
github = Github.new
github.repos.hooks.create 'user-name', 'repo-name',
name:  "web",
active: true,
events: ['push','pull-request'],
config: {
url: "http://localhost:3000/payload",
content_type: "json"
}

但是我得到了以下错误。
Github::Error::NotFound: POST https://api.github.com/repos/user-name/repo-name/hooks: 404 Not Found
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/response/raise_error.rb:14:in `on_complete'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/response.rb:9:in `block in call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/response.rb:57:in `on_complete'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/request/url_encoded.rb:15:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/request/multipart.rb:14:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/request/jsonize.rb:23:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.0/lib/faraday/connection.rb:177:in `post'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/request.rb:68:in `call'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/request/verbs.rb:35:in `post_request'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/client/repos/hooks.rb:122:in `create'
from /home/kamal-ubuntu/.rvm/gems/ruby-2.1.5/gems/github_api-0.12.2/lib/github_api/api.rb:224:in `block in execute'

1
尝试将用户名称和仓库名称更改为实际名称,当前的URL当然是一个损坏的链接。 - Sean Xiao
我已经使用了实际的用户名和仓库名,但是它仍然给我相同的错误。在发布问题时,我只是修改了用户名和仓库名。 - archana
网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接