I'm having issues cloning using the file transport when the remote is hosted on a network drive.
I downloaded the project and tried adding some test cases:
[Fact]
public void CanCloneALocalRepositoryFromANetworkDriveUri()
{
var networkPath = @"file:///192.168.1.1/Share/TestRepo.git";
var uri = new Uri(networkPath);
AssertLocalClone(uri.AbsoluteUri, BareTestRepoPath);
}
That fails with:
LibGit2Sharp.LibGit2SharpException : failed to resolve path 'file://192.168.1.1/Share/TestRepo.git': The filename, directory name, or volume label syntax is incorrect.
I tried mapping a drive letter (Z:) to the share, and ran this:
[Fact]
public void CanCloneALocalRepositoryFromAMappedNetworkDrive()
{
var networkPath = @"file:///Z:/TestRepo.git";
var uri = new Uri(networkPath);
AssertLocalClone(uri.AbsoluteUri, BareTestRepoPath);
}
That fails with:
LibGit2Sharp.LibGit2SharpException : failed to resolve path 'Z:/TestRepo.git': The system cannot find the path specified.
unless I set:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLinkedConnections
to a DWORD value of 1, as per this TechNet article - in which case the clone succeeds. However, this is not a viable solution in my situation, as it raises deployment issues in security-conscious environments.
It appears that LibGit2Sharp is not capable of cloning from a file UNC. Have I understood correctly, and if so is there any way to work around this?