TFS 2015 build server with git line endings
We use TFS 2015 with GIT and Team Foundation Build 2015 as Build definition. The Sources are in C/C++.
On the Build Server I’m facing a line ending problem.
On the developers PC (Microsoft Windows 7) the core.autocrlf=true is set. The line endings are always CRLF which is ok.
- How do I configure TFS Git permissions such that users can push to all branches other than master?
- UNABLE_TO_GET_ISSUER_CERT_LOCALLY when installing private bower package from TFS
- Connect to TFS Git from Xamarin Studio (non-hosted, locally installed TFS 2013)
- Git-Tfs: A TFS changeset per Git Commit?
- Code review report with VSTS
- Migrate from local Git repository to TFS source control project with all history
On the Build Server (Microsoft Server 2012 R2) the same core.autocrlf=true is set. If I get the sources on the Build Server on the command line (git version 2.7.2.windows.1) everything is ok and all source files has CRLF as line ending.
But if the Build definition (e.g. for continuous integration) gets the sources, the line endings are always LF.
Where can I set the core.autocrlf=true for the Build definition?
2 Solutions collect form web for “TFS 2015 build server with git line endings”
I found the problem and the solution.
core.autocrlf true is correct for my environment. But the Build Server starts the Build with a different user as I was logged in to do the check of the settings.
Solution: Make sure the all users on the Build server has the same setting.
I set an Environment System Variable
HOME to the directory
C:\GitHome. Within this directory the file
.gitconfig is placed with the correct setting.
This works for my case.
Assuming you are using vNext build. Get Source is a automatic step, we can’t set or modify this step.
Just have a quick test, set core.autocrlf to
True with command
git config --global core.autocrlf true. Then run vNext build, the source will be checked out to
%agent%\_work\xx\s. After that, under this working folder, run command
git config --list, you’ll see
core.autocrlf=true. Get-source step doesn’t change the core.autocrlf. You may try with this way.
This article provides more information on how to deal with line endings.