You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
I extracted all the relevant code from my project to make a working example, using one of my public repo's here on github:
varnodegit=require('nodegit'),path=require('path');vartmp=newDate().getTime(),clonePath=path.resolve(__dirname,'./clones/'+tmp),gitPath=path.resolve(__dirname,'./clones/'+tmp+'/.git');varperformFetch=function(){nodegit.Repository// Open the specified directory.open(gitPath).then(function(repo){returnrepo.fetch("origin",{credentials: function(url,userName){returnnodegit.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
Activity
johnhaley81 commentedon Dec 8, 2014
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:
An unauthorized should return a different error.
If that doesn't work for you feel free to re-open this issue.
Athaphian commentedon Dec 8, 2014
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.
johnhaley81 commentedon Dec 8, 2014
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:
johnhaley81 commentedon Dec 8, 2014
One more note. This flag is set on the
remoteobject and will persist on that object. If you make a new remote you'll have to reset that flag.Athaphian commentedon Dec 8, 2014
I don't think that is correct, since that code example does not compile..
maxkorp commentedon Dec 8, 2014
Reopened this for you, Athaphian. FYI, the reopen button is usually under the text input, next to "comment".
Athaphian commentedon Dec 8, 2014
Thanx maxkorp, the button was not there. Now there is a button 'Close and comment'.
maxkorp commentedon Dec 8, 2014
Interesting. I'll take a look through the repo permissions... Thanks for the heads up.
Athaphian commentedon Dec 8, 2014
I extracted all the relevant code from my project to make a working example, using one of my public repo's here on github:
This code results in:
Done cloning.
/.../node_modules/nodegit-promise/node_modules/asap/asap.js:45
throw e;
^
Error: The SSL certificate is invalid
johnhaley81 commentedon Dec 8, 2014
I miss aligned my brackets. I just ran that locally. In your code you'll just pass that same argument.
Athaphian commentedon Dec 8, 2014
Ok that didn't give me an error, I will now check to see if the fetch really works..
johnhaley81 commentedon Dec 8, 2014
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
Athaphian commentedon Dec 8, 2014
Good to know.
With that 'true' in the correct place, it all works now. Thanks :)
johnhaley81 commentedon Dec 8, 2014
Great! Glad to hear it :)
Certificate is still invalid
tjcarroll11 commentedon Aug 15, 2017
Also want to note that I randomly ran into this error on a CentOS machine and found that setting
on the remote connection options cured it.