5

TFS 2015 Update 2 带来了 Git LFS 支持,但是当我尝试将它与 Brian Keller VS2015ALM 虚拟机(升级到更新 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)。因此,如何提供凭据似乎是一个问题,但如何解决呢?

回购步骤:

  1. 在 TFS 门户网站上创建一个 repo
  2. 用 VS 或 git 克隆它
  3. 执行“git lfs install”
  4. 执行“git lfs filter track "*.jpg"”
  5. 将图像添加到工作区
  6. 犯罪
  7. 执行“git push origin master”=> git.exe 失败
  8. 执行“git push origin master”=> 与 VS 一起使用
  9. 添加第二个图像并提交
  10. 推送现在适用于 git.exe
  11. 删除本地仓库
  12. 克隆 repo => 使用 git.exe 或 VS 结帐失败

我尝试使用“clone -n​​”来避免立即结帐,然后执行“git lfs install”和“git checkout master”,发生了同样的异常:您的用户名必须采用 DOMAIN\user 格式。目前是 brian%!(EXTRA str ring=string)

4

2 回答 2

3

适用于 Windows 的 Git Credential Manager帮助我让它工作。

只需使用 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

于 2016-05-17T12:16:59.910 回答
0

根据错误异常,您的 TFS 服务器正在使用“NTLM”进行身份验证。使用此身份验证,您必须输入用户名:{DOMAIN}{user} 和密码:{pass}。因此,将您的 git 凭据更新为这种格式,然后重试。查看此链接了解详细信息:使用 Git-Lfs 进行 NTLM 身份验证

如果 LFS 服务器返回 "Www-Authenticate: NTLM" 标头,我们将设置 lfs.{endpoint}.access 为 ntlm 并重新提交 http 请求。后续请求将通过 ntlm 身份验证流程。

我们将 NTLM 凭据存储在凭据帮助程序中。当提示用户输入凭据时,他们必须使用用户名:{DOMAIN}{user} 和密码:{pass}

ntlm protocl 将由 ntlm.go 类处理,该类隐藏 InitHandshake、Authenticate 和 Challenge 的实现。这允许对现有的 client.go 类进行最小的更改。

于 2016-05-02T08:19:38.167 回答