| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There seems to be an issue with GitHub's cert being falsely flagged as invalid on OSX. You can bypass the check during clone like this:
var url = "https://github.com/nodegit/test.git";
var opts = { ignoreCertErrors: 1 };
return Clone.clone(url, https, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});An unauthorized should return a different error.
If that doesn't work for you feel free to re-open this issue.
Not really sure how to reopen an issue on github, but I have used the example 'clone.js' which uses the ignoreCertErrors flag. The error happens when I run the fetch example on the same repo.
The button next to "Comment" should be "Reopen Issue" or "Reopen and comment".
Ah! So this is only during fetch and clone is fine. Ok so fetch needs the same flag but it's set differently inside of libgit2. Luckily it's pretty easy with the convenience function:
var nodegit = require('nodegit');
nodegit.Repository.open("path/to/repo/.git").then(function(repo) {
return repo.fetch("origin", {
credentials: function(url, userName) {
return nodegit.Cred.sshKeyFromAgent(userName);
},
true /* ignoreCertErrors */
});
});One more note. This flag is set on the remote object and will persist on that object. If you make a new remote you'll have to reset that flag.
I don't think that is correct, since that code example does not compile..
Reopened this for you, Athaphian. FYI, the reopen button is usually under the text input, next to "comment".
Thanx maxkorp, the button was not there. Now there is a button 'Close and comment'.
Interesting. I'll take a look through the repo permissions... Thanks for the heads up.
I extracted all the relevant code from my project to make a working example, using one of my public repo's here on github:
var nodegit = require('nodegit'),
path = require('path');
var tmp = new Date().getTime(),
clonePath = path.resolve(__dirname, './clones/' + tmp),
gitPath = path.resolve(__dirname, './clones/' + tmp + '/.git');
var performFetch = function () {
nodegit.Repository
// Open the specified directory
.open(gitPath).then(function (repo) {
return repo.fetch("origin", {
credentials: function (url, userName) {
return nodegit.Cred.sshKeyFromAgent(userName);
}
});
})
.done(function () {
console.log('Done fetching.');
});
};
nodegit.Clone.clone('https://github.com/Athaphian/grunt-websocket.git', clonePath,
{ignoreCertErrors: 1})
.done(function () {
console.log('Done cloning.');
performFetch();
});This code results in:
Done cloning.
/.../node_modules/nodegit-promise/node_modules/asap/asap.js:45
throw e;
^
Error: The SSL certificate is invalid
var nodegit = require('nodegit');
nodegit.Repository.open("path/to/repo/.git").then(function(repo) {
return repo.fetch("origin", {
credentials: function(url, userName) {
return nodegit.Cred.sshKeyFromAgent(userName);
}
},
true /* ignoreCertErrors */);
});I miss aligned my brackets. I just ran that locally. In your code you'll just pass that same argument.
Ok that didn't give me an error, I will now check to see if the fetch really works..
TIL if a repo owner closes an issue then the issue creator can't reopen it.
http://stackoverflow.com/questions/21333654/how-to-re-open-an-issue-in-github
Good to know.
With that 'true' in the correct place, it all works now. Thanks :)
Great! Glad to hear it :)
Also want to note that I randomly ran into this error on a CentOS machine and found that setting
certificateCheck: function() {
return 1;
}
on the remote connection options cured it.
| Back | FazBrowse Home | New Git URL |
I have cloned a github repo using https. Running the fetch example gives me:
/..../node_modules/nodegit-promise/node_modules/asap/asap.js:45
throw e;
^
Error: The SSL certificate is invalid
Which is probably a correct message, since I never created any SSL certificate. I will try this example using SSH, but I would like HTTPS to work aswel.