1- // Require in NodeGit, since we want to use the local copy, we' re using a
1+ // Require in NodeGit, since we want to use the local copy, we" re using a
22// relative path. In your project, you will use:
33//
4- // var NodeGit = require(' nodegit' );
5- var Git = require ( ' ../../../' ) ;
4+ // var NodeGit = require(" nodegit" );
5+ var Git = require ( " ../../../" ) ;
66
77// To clone with two factor auth enabled, you have to use a GitHub OAuth token
88// over HTTPS.
9- var GITHUB_TOKEN = ' <GH_TOKEN>' ;
9+ var GITHUB_TOKEN = " <GH_TOKEN>" ;
1010
1111// Using the `clone` method from the `Git.Clone` module, bring down the NodeGit
1212// test repository from GitHub.
13- var cloneURL = ' https://github.com/nodegit/private' ;
13+ var cloneURL = " https://github.com/nodegit/private" ;
1414
1515// Ensure that the `tmp` directory is local to this file and not the CWD.
16- var localPath = require ( ' path' ) . join ( __dirname , ' tmp' ) ;
16+ var localPath = require ( " path" ) . join ( __dirname , " tmp" ) ;
1717
1818// Simple object to store clone options.
1919var cloneOptions = { } ;
@@ -23,12 +23,12 @@ var cloneOptions = {};
2323cloneOptions . remoteCallbacks = {
2424 certificateCheck : function ( ) { return 1 ; } ,
2525 credentials : function ( ) {
26- return Git . Cred . userpassPlaintextNew ( GITHUB_TOKEN , ' x-oauth-basic' ) ;
26+ return Git . Cred . userpassPlaintextNew ( GITHUB_TOKEN , " x-oauth-basic" ) ;
2727 }
2828} ;
2929
3030// Invoke the clone operation and store the returned Promise.
31- var cloneRepository = Git . Clone . clone ( cloneURL , localPath , cloneOptions ) ;
31+ var cloneRepository = Git . Clone ( cloneURL , localPath , cloneOptions ) ;
3232
3333// If the repository already exists, the clone above will fail. You can simply
3434// open the repository in this case to continue execution.
@@ -41,8 +41,5 @@ var errorAndAttemptOpen = function() {
4141cloneRepository . catch ( errorAndAttemptOpen )
4242 . then ( function ( repository ) {
4343 // Access any repository methods here.
44- console . log ( 'Is the repository bare? %s' , Boolean ( repository . isBare ( ) ) ) ;
45- } )
46- . catch ( function ( ex ) {
47- console . log ( ex , ex . stack ) ;
44+ console . log ( "Is the repository bare? %s" , Boolean ( repository . isBare ( ) ) ) ;
4845 } ) ;
0 commit comments