Tag: nodegit

如何使用ssh克隆git仓库与nodegit

我试图使用库nodegit(版本0.2.4)和ssh从node.js中的teamforge服务器中克隆git仓库。 我们的服务器请求来自用户的身份validation,当我试图只使用克隆方法而不传递选项时,我得到错误:“callback无法初始化SSH凭据”。 我有private.key和public.key文件中的私钥和公钥。 他们在我已经设置为web风暴工作目录的目录中,所以位置不应该是一个问题。 没有find例子如何做到这一点(也许我错过了),但下面的代码是最接近我得到: 'use strict'; var nodegit = require("nodegit"), Clone = nodegit.Clone, cred = nodegit.Cred; var options = { remoteCallbacks: { credentials: function () { return cred.sshKeyNew('user', 'public.key', 'private.key', ''); } } }; Clone.clone("ssh://user@teamforgeserver.net/reponame", "localTmp", options) .then(function(repo) { var r = repo; }, function(err){ var e = err; } ); 我得到这个错误: TypeError: Object […]

javascript nodegit无法find远程

伙计们,我有一个名为user/foo的分支,我想从远程查看。 码: Git.prototype.refresh = function refresh(branch) { var options = { credentials: function() { return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic"); }, certificateCheck: function() { return 1; } }; return NodeGit.Repository.open(localPath).then(function (repo) { return repo.checkoutBranch(branch, options).then(function (checkoutresult) { return repo.fetchAll(options).then(function (result) { return Promise.resolve(result); }).catch(function (err) { console.log('Unable to fetch',err); return Promise.reject(new Error(err)); }); }).catch(function(err) { console.log('checkoutBranch',err); return Promise.reject(new […]

Nodegit:如何修改文件并推送更改?

看看周围的例子,但找不到一个。 文档没有解释,我无法弄清楚。 如何修改文件(例如README.md),为修改后的文件创build提交,然后将提交推送到服务器? Nodegit: http ://www.nodegit.org/ Nodegit文档: http ://www.nodegit.org/nodegit

使用nodegit切换分支/标记

我一直试图打开一个现有的repo,并使用nodegit更改分支或标记。 该文件是广泛的,但似乎是过时的。 任何想法,我做错了什么? var NodeGit = require("nodegit"); var open = NodeGit.Repository.open; var Tag = NodeGit.Tag; var Checkout = NodeGit.Checkout; open(location).then(function (repo) { Tag.list(repo).then(function(array) { // array is ['v1.0.0'] var ref = array[0] Checkout.tree(repo, ref).then(function() { // Want tag to be checked out out in detached state. }); }); });