git - libgit2sharp branch not found on freshly cloned repo -


libgit2sharp 0.21.0.176 c# on windows server 2008

i need obtain reference specific branch.

on windows machine, fresh git clone local repo remote origin on github.

next execute following libgit2sharp code :

var localrepo = new repository({local-path},repositoryoptions); var remote = localrepo.network.remotes.add("origin", {remote-repo-uri); localrepo.network.fetch(remote, fetchoptions, signature, "performing fetch"); var branch = localrepo.branches[{branch-name}]; 

but branch not present in collection though exists on remote origin on github.

similarly git, default branch (or 1 has been specified in cloneoptions.branchname) created local head upon cloning.

other branches fetched, remote tracking branches.

two options:

  • given remote named "origin", can access remote tracking branches throughlocalrepo.branches["origin/{branch-name}"];
  • you create local branch , configure track remote counterpart. see branchfixture.cansetupstreambranch() test example of how this.

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -