TFS生成代理无法找到.certifcate文件

问题描述

 1. 2020-09-18T19:03:37.9661852Z ##[debug]Evaluating condition for step:
    'Get Sources'
 2. 2020-09-18T19:03:37.9783485Z ##[debug]Evaluating: Succeedednode()
 3. 2020-09-18T19:03:37.9798521Z ##[debug]Evaluating Succeedednode:
 4. 2020-09-18T19:03:37.9848754Z ##[debug]=> True    
 5. 2020-09-18T19:03:37.9888404Z ##[debug]Result:
True 
 6. 2020-09-18T19:03:37.9971561Z ##[section]Starting: Get Sources    
 7. 2020-09-18T19:03:38.0033628Z ##[debug]Sync source for endpoint: DIAMONDS
 8. 2020-09-18T19:03:38.0470845Z Syncing repository: DIAMONDS (Tfsgit)
 9. 2020-09-18T19:03:38.0560347Z Prepending Path environment variable
    with directory containing 'git.exe'.
 10. 2020-09-18T19:03:38.0571574Z ##[debug]Path:
     'C:\Agent\vsts-agent-win-x64-2.136.1\externals\git\cmd;C:\Program
     Files\Common Files\Oracle\Java\javapath;C:\Program Files
     (x86)\Common
     Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program
     Files (x86)\HID Global\ActivClient\;C:\Program Files\HID
     Global\ActivClient\;C:\Program Files\dotnet\;C:\Program
     Files\Microsoft sql
     Server\130\Tools\Binn\;C:\Users\svc.dsms.vissvc.sa\AppData\Local\Microsoft\WindowsApps'
 11. 2020-09-18T19:03:38.0618801Z ##[debug]Get git version. 
 12. 2020-09-18T19:03:38.0659586Z ##[command]git version
 13. 2020-09-18T19:03:38.4081255Z git version 2.17.1.windows.2
 14. 2020-09-18T19:03:38.4111608Z ##[debug]Detect git version: 2.17.1.
 15. 2020-09-18T19:03:38.4204178Z ##[debug]Set git useragent to:
     git/2.17.1 (vsts-agent-git/2.136.1).
 16. 2020-09-18T19:03:38.4267175Z
     ##[debug]Checking if the repo on C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s matches the expected
     repository origin URL. expected Url: https://XXX 
 17. 2020-09-18T19:03:38.4320839Z ##[debug]Inspect remote.origin.url for
     repository under C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s
 18. 020-09-18T19:03:38.4321081Z ##[command]git config --get
     remote.origin.url
 19. 2020-09-18T19:03:38.7395942Z ##[debug]Get remote origin fetch url
     from git config: https:XXX
 20. 2020-09-18T19:03:38.7396356Z ##[debug]Repository remote origin
     fetch url is https://XXX 
 21. 2020-09-18T19:03:38.7396743Z ##[debug]URLs match.
 22. 2020-09-18T19:03:38.7431528Z ##[debug]Delete untracked 
     files/folders for repository at 
     C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s.
 23. 2020-09-18T19:03:38.7467645Z ##[command]git clean -fdx
 24. 2020-09-18T19:03:39.0583899Z ##[debug]Undo any changes to tracked
     files in the working tree for repository at
     C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s.
 25. 2020-09-18T19:03:39.0585957Z ##[command]git reset --hard HEAD
 26. 2020-09-18T19:03:39.2995536Z fatal: ambiguous argument 'HEAD':
     unkNown revision or path not in the working tree. 
 27. 2020-09-18T19:03:39.3000326Z Use '--' to separate paths from
     revisions,like this: 
 28. 2020-09-18T19:03:39.3022533Z 'git <command> [<revision>...] --
     [<file>...]' 
 29. 2020-09-18T19:03:39.3195495Z
     ##[debug]'git reset --hard HEAD' Failed with exit code 128 For 
 30. futher investigation,manually run 'git reset --hard HEAD' on repo
root: C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s after each
     build.
 31. 2020-09-18T19:03:39.3226184Z ##[warning]Unable to run "git clean 
     -fdx" and "git reset --hard HEAD" successfully,delete source folder instead.
 32. 2020-09-18T19:03:39.3415125Z ##[debug]Init git repository at:
     C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s.
 33. 2020-09-18T19:03:39.3415414Z ##[command]git init
     "C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s"
 34. 2020-09-18T19:03:39.8849476Z Initialized empty Git repository in
     C:/Agent/vsts-agent-win-x64-2.136.1/_work/2/s/.git/ 
 35. 2020-09-18T19:03:39.9152342Z ##[debug]Add git remote: origin to
     url: https://XXXfor repository under:
     C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s.
 36. 2020-09-18T19:03:39.9152668Z ##[command]git remote add origin
     https://XXX
 37. 2020-09-18T19:03:40.2769659Z ##[debug]disable git auto garbage
     collection. 
 38. 2020-09-18T19:03:40.2769869Z ##[command]git config gc.auto 0
 39. 2020-09-18T19:03:40.5400860Z ##[debug]Checking git config
     http.https://XXX.extraheader exist or not
 40. 2020-09-18T19:03:40.5401139Z ##[command]git config --get-all
     http.https://XXX.extraheader 
 41. 2020-09-18T19:03:40.7805892Z
     ##[debug]Checking git config http.proxy exist or not
 42. 2020-09-18T19:03:40.7806064Z ##[command]git config --get-all
     http.proxy 
 43. 2020-09-18T19:03:41.0134148Z ##[debug]Fetch git
          repository at: C:\Agent\vsts-agent-win-x64-2.136.1\_work\2\s
          remote: origin. 
 44. 2020-09-18T19:03:41.0174569Z ##[command]git -c 
     http.extraheader="AUTHORIZATION: bearer ***" fetch --tags --prune 
     --progress --no-recurse-submodules origin
 45. 2020-09-18T19:03:41.5941543Z fatal: unable to access 'https://XXX':
     error setting certificate verify locations: 
 46. 2020-09-18T19:03:41.5958389Z   CAfile: C:/Program
     Files/Git/mingw64/ssl/certs/ca-bundle.crt
 47. 2020-09-18T19:03:41.5958752Z   CApath: none
 48. 2020-09-18T19:03:41.6419509Z ##[error]Git fetch Failed with exit
     code: 128 
 49. 2020-09-18T19:03:41.6467215Z
 50. ##[debug]system.invalidOperationException: Git fetch Failed with exit code: 128

   

at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.<GetSourceAsync>d__23.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildJobExtension.<GetSourceAsync>d__17.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Services.Agent.Worker.JobExtensionRunner.<RunAsync>d__21.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext() 2020-09-18T19:03:41.6475180Z ##[section]Finishing: Get Sources

解决方法

请尝试以下方法:

  1. 在“ C:/ Program Files / Git”文件夹中查找ca-bundle.crt。如果找到此文件,请将其复制并粘贴到“ C:/ Program Files / Git / mingw64 / ssl / certs / ca-bundle.crt”。

  2. 将路径固定为“ C:\ Program Files \ Git \ mingw64 \ ssl \ certs \ ca-bundle.crt”

    git config --system http.sslcainfo“ C:\ Program Files \ Git \ mingw64 \ ssl \ certs \ ca-bundle.crt”

  3. 通过执行以下命令完全关闭所有SSL检查:

    git config --system http.sslverify false

由于您在结帐步骤中遇到了此问题,因此可以使用

steps:
- checkout: none

首先禁用结帐步骤。 完成上述命令后,在任务中使用git checkout命令来检出存储库。

有关更多详细信息,请参考此票证:Github: error cloning my private repository