将 Git LFS 与 TFS 2015 Update 2 OnPremise 结合使用
Use Git LFS with TFS 2015 Update 2 OnPremise
TFS 2015 Update 2 带来了 Git LFS 支持,但是当我尝试将它与 Brian Keller VS2015ALM 虚拟机(升级到 Update 2)一起使用时,我遇到了这个异常:
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=
这在我尝试使用 git.exe 推送时附加,并在第一次使用 VS2015U2 推送后工作。但是现在当我尝试使用 git.exe 或 VS2015U2 重新克隆我的存储库(结帐失败)时出现此错误。顺便说一下,VS 在这种情况下完全崩溃了。我用 VSTS 尝试了相同的操作,没有发生错误(使用 git.exe、GitExtensions 或 VS2015U2)。因此,提供凭据的方式似乎存在问题,但如何解决?
回购步骤:
- 在 TFS 门户网站上创建存储库
- 用 VS 或 git
克隆它
- 执行"git lfs install"
- 执行"git lfs filter track "*.jpg""
- 将图像添加到工作区
- 提交
- 执行 "git push origin master" => 失败 git.exe
- 执行 "git push origin master" => 使用 VS
- 添加第二张图片并提交
- 推送现在适用于 git.exe
- 删除本地存储库
- 克隆回购 => 使用 git.exe 或 VS
检出失败
我尝试使用 "clone -n" 来避免立即结账,然后我执行 "git lfs install" 和 "git checkout master",同样的异常发生了:
您的用户名必须采用 DOMAIN\user 格式。目前是 brian%!(额外 st
环=串)
根据错误异常,您的 TFS 服务器正在使用 "NTLM" 进行身份验证。使用此身份验证,您必须输入用户名:{DOMAIN}{user} 和密码:{pass}。因此,请将您的 git 凭据更新为这种格式,然后重试。查看此 link 了解详细信息: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.
Git Credential Manager for Windows 帮助我让它工作。
只需使用 GCMW 并在出现第一个凭据提示时(凭据存储在 Windows 凭据管理器中):
- 用户名:"vsalm\brian"
- 密码:"P2ssw0rd"
而且有效。
- 没有 GCMW,它不起作用。
- 它与Git 2.8安装提供的GCMW一起工作,手动安装1.2.2和1.3(通过在gitconfig中添加“[credential] helper = manager”)
注意:使用 VS2015U2 克隆不起作用,计划在 U3 中进行修复。更多信息:https://connect.microsoft.com/VisualStudio/feedback/details/2657886/cant-use-git-lfs-with-tfs-2015-update-2-onpremise
TFS 2015 Update 2 带来了 Git LFS 支持,但是当我尝试将它与 Brian Keller VS2015ALM 虚拟机(升级到 Update 2)一起使用时,我遇到了这个异常:
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=
这在我尝试使用 git.exe 推送时附加,并在第一次使用 VS2015U2 推送后工作。但是现在当我尝试使用 git.exe 或 VS2015U2 重新克隆我的存储库(结帐失败)时出现此错误。顺便说一下,VS 在这种情况下完全崩溃了。我用 VSTS 尝试了相同的操作,没有发生错误(使用 git.exe、GitExtensions 或 VS2015U2)。因此,提供凭据的方式似乎存在问题,但如何解决?
回购步骤:
- 在 TFS 门户网站上创建存储库
- 用 VS 或 git 克隆它
- 执行"git lfs install"
- 执行"git lfs filter track "*.jpg""
- 将图像添加到工作区
- 提交
- 执行 "git push origin master" => 失败 git.exe
- 执行 "git push origin master" => 使用 VS
- 添加第二张图片并提交
- 推送现在适用于 git.exe
- 删除本地存储库
- 克隆回购 => 使用 git.exe 或 VS 检出失败
我尝试使用 "clone -n" 来避免立即结账,然后我执行 "git lfs install" 和 "git checkout master",同样的异常发生了: 您的用户名必须采用 DOMAIN\user 格式。目前是 brian%!(额外 st 环=串)
根据错误异常,您的 TFS 服务器正在使用 "NTLM" 进行身份验证。使用此身份验证,您必须输入用户名:{DOMAIN}{user} 和密码:{pass}。因此,请将您的 git 凭据更新为这种格式,然后重试。查看此 link 了解详细信息: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.
Git Credential Manager for Windows 帮助我让它工作。
只需使用 GCMW 并在出现第一个凭据提示时(凭据存储在 Windows 凭据管理器中):
- 用户名:"vsalm\brian"
- 密码:"P2ssw0rd"
而且有效。
- 没有 GCMW,它不起作用。
- 它与Git 2.8安装提供的GCMW一起工作,手动安装1.2.2和1.3(通过在gitconfig中添加“[credential] helper = manager”)
注意:使用 VS2015U2 克隆不起作用,计划在 U3 中进行修复。更多信息:https://connect.microsoft.com/VisualStudio/feedback/details/2657886/cant-use-git-lfs-with-tfs-2015-update-2-onpremise