Floyd
Floyd

Reputation: 363

Use Git LFS with TFS 2015 Update 2 OnPremise

TFS 2015 Update 2 brings Git LFS support, but when I tried to use it with the Brian Keller VS2015ALM virtual machine (upgraded to Update 2), I got this exception :

git-lfs/1.2.0 (GitHub; windows amd64; go 1.6.1; git 386c5d8)
git version 2.8.1.windows.1

$ git-lfs.exe smudge -- Image1.jpg
Error downloading object: Image1.jpg (968bda1e0a17e295e265311f93bc4e631e171
d776d51c6d7a43b52185c82631a)

Your user name must be of the form DOMAIN\user. It is currently brian%!(EXTRA st
ring=string)
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
        C:/Users/techn/go/src/github.com/github/git-lfs/lfs/errors.go:566 +0x87
github.com/github/git-lfs/commands.logPanicToWriter(0x1a42c0, 0xc082020020, 0x1b
54a0, 0xc0823ae1a0)
        C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:195
 +0xf87
github.com/github/git-lfs/commands.logPanic(0x1b54a0, 0xc0823ae1a0, 0x0, 0x0)
        C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:159
 +0x419
github.com/github/git-lfs/commands.handlePanic(0x1b54a0, 0xc0823ae1a0, 0x0, 0x0)

        C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:134
 +0x55
github.com/github/git-lfs/commands.LoggedError(0x1b54a0, 0xc0823ae1a0, 0xa25980,
 0x21, 0xc082029c88, 0x2, 0x2)
        C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:84
+0x89
github.com/github/git-lfs/commands.smudgeCommand(0xc52680, 0xc0820f81e0, 0x1, 0x
2)
        C:/Users/techn/go/src/github.com/github/git-lfs/commands/command_smudge.
go:79 +0xdd2
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute
(0xc52680, 0xc0820f8040, 0x2, 0x2, 0x0, 0x0)
        C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/
spf13/cobra/command.go:477 +0x3fb
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute
(0xc536c0, 0x0, 0x0)
        C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/
spf13/cobra/command.go:551 +0x593
github.com/github/git-lfs/commands.Run()
        C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:99
+0x2a
main.main()
        C:/Users/techn/go/src/github.com/github/git-lfs/git-lfs.go:34 +0x135

ENV:
LocalWorkingDir=C:\Users\Brian\Source\Repos\DemoGitLfs
LocalGitDir=C:\Users\Brian\Source\Repos\DemoGitLfs\.git
LocalGitStorageDir=C:\Users\Brian\Source\Repos\DemoGitLfs\.git
LocalMediaDir=C:\Users\Brian\Source\Repos\DemoGitLfs\.git\lfs\objects
LocalReferenceDir=
TempDir=C:\Users\Brian\Source\Repos\DemoGitLfs\.git\lfs\tmp
ConcurrentTransfers=1
BatchTransfer=true
GIT_DIR=.git
GIT_LFS_PATH=C:\Program Files\Git LFS
GIT_PREFIX=

This appends when I tried to push with git.exe and works after a first push with VS2015U2. But now I got this error when I try to re-clone my repo (failed on checkout) with git.exe or VS2015U2. By the way, VS completly crash in this case. I tried the same operations with VSTS, and no error occured (with git.exe, GitExtensions or VS2015U2). So it seems to be a problem with how credentials are provided but how to fix it ?

Repo steps :

  1. Create a repo on TFS web portal
  2. Clone it with VS or git
  3. Execute "git lfs install"
  4. Execute "git lfs filter track "*.jpg""
  5. Add an image to workspace
  6. Commit
  7. Execute "git push origin master" => failed with git.exe
  8. Execute "git push origin master" => works with VS
  9. Add a second image and commit
  10. The push now works with git.exe
  11. Delete local repository
  12. Clone repo => failed on checkout with git.exe or VS

I tried with "clone -n" to avoid immediate checkout, then I execute "git lfs install" and "git checkout master", same exception occured : Your user name must be of the form DOMAIN\user. It is currently brian%!(EXTRA st ring=string)

Upvotes: 5

Views: 2114

Answers (2)

Floyd
Floyd

Reputation: 363

Git Credential Manager for Windows helps me to get it work.

Just use GCMW and at the first credential prompt (credentials are stored in the Windows Credential Manager) :

  • username: "vsalm\brian"
  • password: "P2ssw0rd"

And it works.

  • Without GCMW it does not work.
  • It works with the GCMW provided by the Git 2.8 installation, the manual installation of 1.2.2 and 1.3 (by adding "[credential] helper = manager" in gitconfig)

Note: Clone with VS2015U2 doesn't work, a fix is plan in U3. More info: https://connect.microsoft.com/VisualStudio/feedback/details/2657886/cant-use-git-lfs-with-tfs-2015-update-2-onpremise

Upvotes: 3

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

According to the error exception, your TFS server is using "NTLM" for authentication. With this authentication, you must enter username:{DOMAIN}{user} and password:{pass}. So update your git credentials to this format and then try again. Check this link for details: NTLM Authentication With Git-Lfs.

If the LFS server returns a "Www-Authenticate: NTLM" header, we will set lfs.{endpoint}.access to be ntlm and resubmit the http request. Subsequent requests will go through the ntlm auth flow.

We will store NTLM credentials in the credential helper. When the user is prompted for their credentials they must use username:{DOMAIN}{user} and password:{pass}

The ntlm protocl will be handled by an ntlm.go class that hides the implementation of InitHandshake, Authenticate, and Challenge. This allows miminal changesto the existing client.go class.

Upvotes: 0

Related Questions