Git submodule not working on TFS Build

When I try to build using TFS with Git, there is a limitation where the TFS git provider does not yet support helper modules. A bit of pain, but what the hell can I tell TFS to run a batch file before compiling. I used this to invoke the git script manual to update all of my submodules in my "super" project.

The command executed by this command is simple: git update the submodule --init --recursive

This worked fine and dandy before I migrated the submodule source to TFS, but now the TFS build does not work because the above git script module no longer works.

So, what does TFS do before build. Pulls current sources from git to a folder on the build server that I have access to.

If I open git Bash in this folder and run the following commands: git submodule init git update submodule

I get the following error, and I can not figure out in my life what it is. I tried to search for this specific error, which usually indicates that the compilation of the submodule will be clicked after the repetition of the “super project” is done. But I can verify that all submodules are completed and pushed before the “super project” completes and clicks. Here is the output of the TFS git commands:

james@TFS /C/Builds/1/Technique Webs/MIS Console 5.2 Development/src (5.2development) $ git submodule init james@TFS /C/Builds/1/Technique Webs/MIS Console 5.2 Development/src (5.2development) $ git submodule update Username for 'http://tfs:8080': james Password for 'http://james@TFS:8080': <password> From http://TFS:8080/TFS/Technique/_git/Technique%20Library * branch HEAD -> FETCH_HEAD fatal: reference is not a tree: 33106ea146d470159e327c1b2d623d14f522cdd4 Unable to checkout '33106ea146d470159e327c1b2d623d14f522cdd4' in submodule path 'calc-engine' james@TFS /C/Builds/1/Technique Webs/MIS Console 5.2 Development/src (5.2development) $ 
+8
git tfs tfsbuild tfs2013
source share
2 answers

I fixed a similar problem after many trial and error: it turned out that it was a problem when running the TFS pre-build PowerShell script without a user profile, and therefore GIT could not see the credential cache settings for the assembly user (for example, as indicated in C:\Users\theuser\.gitconfig ).

Batch scripts would suffer from the same problem.

The distinctive behavior was that the git submodule calls completely hung up and put the GIT repository in a very strange state (as noted above in not a tree ).

The damage was caused by a GIT request to use a username and password, however this is a non-interactive session, so everything just stops.

Using wincred as the credential cache, I was able to fix this:

  • Login to the assembly system as the assembly user.
  • Access the GIT server through the command line and enter the necessary credentials.
  • Open Windows Credential Manager and note that cached credentials are visible in the Shared Credentials section.
  • On an extended command line, force GIT to use wincred by default, even if it does not have a user configuration file: git config --system credential.helper wincred
  • Restart the assembly from TFS: it worked.
+4
source share

The reason is that 'Git Bash' does not know the credentials of the build account, and it needs to request each time online for them. In fact, if the assembly account has access to all submodules of the remote repo, you just need to specify an empty username and password to invite credentials. This is not easy on Windows because the credential manager does not accept an empty username.

One way to get around it is to change the URL of the submodule to something like below. The @ symbol is the same as the empty username and password.

 [submodule "..."] path = ... url = http://@tfs:8080/... 
0
source share

All Articles