node.js - javascript nodegit unable to find remote -


folks, have branch called user/foo i'd check out remote. code:

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 fetch',err);                 return promise.reject(new error(err));             });         }).catch(function(err) {             console.log('checkoutbranch',err);             return promise.reject(new error(err));         });     }); }; 

error:

[error: error: reference 'refs/remotes/user/foo/head' not found] 

am using checkoutbranch incorrectly? have remote cloned local directory, , trying switch particular branch.

thanks!

this copypasta nodegit issue

so can checkout local branch. you're trying checkout remote. you'll have get commit on remote branch , use create new branch , (optionally) set upstream track original remote branch.

at point can check out newly created local branch.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -