1

I have a git repos A and B in a Visual Studio Team Services Project. B is a submodule of A with the following config in .gitmodules:

[submodule "my_submodule"]
    path = somefolder/my_submodule
    url = https://xxx.visualstudio.com/xxx/_git/B

If I do a build with the option Repository/Checkout Submodules I get the following error:

Repository type=TfsGit
localPath=C:\a\1\s
clean=False
sourceBranch=refs/heads/submoduletest
sourceVersion=0378dd86db31e4d7bff8de86a482b3d8e72dd3ba
Syncing repository: A (Git)
repository url=https://xxx.visualstudio.com/_git/A
checkoutSubmodules=True
Starting clone
Checking out 0378dd86db31e4d7bff8de86a482b3d8e72dd3ba to C:\a\1\s with submodules
Checked out branch refs/heads/submoduletest for repository A at commit 0378dd86db31e4d7bff8de86a482b3d8e72dd3ba
##[error]LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git': The system cannot find the path specified.
##[error]   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
##[error]   at LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error]Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Prepare repository failed with exception. ---> LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git': The system cannot find the path specified.
##[error]   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
##[error]   at LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
##[error]   at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error]   --- End of inner exception stack trace ---
##[error]   at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error]   at System.Threading.Tasks.Task.Execute()

The interesting error message seems to be:

LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git'

Doing a git clone xxx/A --recursive on my maschine works.

The fantastic docs point to an auth problems: https://www.visualstudio.com/en-us/docs/build/define/repository

But this says nothing about auth and even using a relative path in .gitmodules does not result in a different error message.

Any ideas?

Update 1

For testing purposes I used a branch. I merged the changes (adding submodule) to master and retried - now with the following error:

##[error]LibGit2Sharp.NotFoundException: Object not found - no matching loose object (4fa408bc7b29e87b7032e0f78998516ff4a4da00)

That hash is the HEAD of my submodule - clearly available.

1

2 Answers 2

1

@eddie-msft was right with his comment: there was a folder with the same name on master. The checkout to my test branch did not remove the folder. While this works when I do it locally, VS Team Serivices seems to have a problem with that.

But there was another problem: Contrary to the documentation, I hat to provide the full url to the submodule (https://xxx.visualstudio.com/xxx/_git/B). The documentation states that I should use a relative url (../B or ../../B - its a guessing game) but that does not work.

Sign up to request clarification or add additional context in comments.

Comments

0

There is some issue with your .gitmodules file. Usually, the path in the file should be your submodule repository name("B" in your scenario).

3 Comments

Not necessarliy, I used $ git submodule add <repository> <path> so that the submodule is checked out in the folder "somefolder/my_submodule". Works on my machine.
@kuechlerm Then you may need to try with relative path: visualstudio.com/en-us/docs/build/define/…
@kuechlerm Can check if there is a "my_submodule" file in "somefolder" folder which matches "path = somefolder/my_submodule" in Repo A from VSTS Web Portal? The error can be also caused by the file is been deleted in the repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.