作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
var GitHubApi = require("github");
var github = new GitHubApi({
// required
version: "3.0.0",
// optional
debug: true,
protocol: "https",
host: "github.com",
//pathPrefix: "/joyent/node", // for some GHEs
timeout: 5000
});
github.gitdata.getCommit({
user: "bnoordhuis",
repo: "/joyent/node",
sha: "c30cc4e3a5ead3ca5b48e8eec445740775888ed8"
}, function(err, res) {
console.log(JSON.stringify(res));
});
我发布了上面的代码。我在github中随机找了一个分支进行测试。我还发现了一个随机用户以及该用户的随机提交。我在这里阅读了有关 API 的信息:http://mikedeboer.github.io/node-github/#gitdata.prototype.getCommit
当我运行上面的代码时,我得到错误代码 404,null bnoordhuis未定义
任何帮助都会很棒!我是 github api 的新手。
这是我尝试使用的存储库:https://github.com/joyent/node/
最佳答案
您的存储库应该只是“节点”。 Joyent 是用户。
关于javascript - 无法让 gitHub API 在 javascript 中工作。特别是 gitdata.getCommit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22506972/
var GitHubApi = require("github"); var github = new GitHubApi({ // required version: "3.0.0"
我是一名优秀的程序员,十分优秀!