Giter Site home page Giter Site logo

javascript-nodegit-clone-infinite-retry-fix-demo's Introduction

JavaScript Nodegit Clone Infinite Retries Fix Demo

在Nodegit中有一个问题,当我们使用username/password去clone一个repo时,如果有误,它不会退出,而是进入死循环,一直重试。

这个issue位于: nodegit/nodegit#1133

错误原因应该是来自由底层使用的libgit2库:nodegit/nodegit#1133 (comment)

所以我们只能手动的记录一下重试次数,发现次数过多时,自己throw一个error强迫它退出。

在我们这个Demo里,直接写死了一个错误的用户名和密码,供重现问题:

node demo.js

输出如下:

---------------- credentials (tries: 1)---------------
---------------- credentials (tries: 2)---------------
---------------- credentials (tries: 3)---------------
Authentication is failed with 3 tries, please check your username and password
{ Error: Method clone has thrown an error. errno: -1, errorFunction: 'Clone.clone' }

注意

在Mac下使用nodegit比较麻烦,参考这里的准备工作:https://github.com/freewind-demos/javascript-nodegit-clone-demo

javascript-nodegit-clone-infinite-retry-fix-demo's People

Contributors

freewind avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.