我使用libgit2sharp,我有卢布连接到我的远程回购。
我可以连接到本地回购,但是当我尝试使用我的回购https://github.com/myProject/myRepo我得到一个错误
LibGit2Sharp.LibGit2SharpException: failed to make directory './https:': The filename, directory name, or volume label syntax is incorrect.
这大概是因为我没有使用正确的语法。我试过没有https://开头,以www。我试过只是myProject的/ myRepo,但他们似乎并不管用。
这是有问题的代码。 PathToRepo是回购路径,每当我检查我的回购的分支创建后,我ee值,它是没有连接到远程回购。回购似乎没有问题创造,但它只是不会同步到我的回购协议。 IE浏览器。我可以把一些虚假的回购路径,它会没有问题创造只是不工作。
if (!Repository.IsValid(PathToRepo))
{
Repository.Init(PathToRepo);
}
repo = new Repository((PathToRepo));
var brnch = repo.Branches.Where(x => x.FriendlyName == Branch).FirstOrDefault();
if (brnch == null)
{
brnch = repo.CreateBranch(Branch);
}
Commands.Checkout(repo, brnch);
只是一种猜测,但你可能想使用git的URL,而不是尝试。因此,尝试像https://github.com/torvalds/linux.git
代替https://github.com/torvalds/linux
看看你使用LibGit2Sharp.Repository
类的源:https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs
构造函数说String path
参数是一个目录。我不明白,这可与网络地址的任何建议,所以我怀疑你只使用构造可与在本地目录本地资源库。
通过同一个源文件快速搜索后,我发现ListRemoteReferences
这可能会列出您的远程回购参考,并Clone
这将可能克隆远程回购。 (我还没有尝试过任何这些我自己的)。