GitLink
GitLink copied to clipboard
No local repository is found - NullReferenceException
I've just set up GitVersion to use dynamic repository and I wanted to GitLink to work the same way. It seems to almost work but breaks somewhere in LibGit2. Here's my output.
[Apptical.Libs.sln] GitHubLink (1s)
[GitHubLink] Exec (1s)
[Exec] "Tools\GitLink\GitLink.exe" "C:\TeamCity\buildAgent\work\f18fd9d2d9018dcf" -f \path\solution.sln -u https://bitbucket.org/X/Y -c Release.Prod -p x64 -s 7b479cdf3040f0e7f436d0e4baeff753aa5dc355
[Exec] GitLink v2.3.0.0
[Exec] ================
[Exec]
[Exec] Arguments: C:\TeamCity\buildAgent\work\f18fd9d2d9018dcf -f \path\solution.sln -u https://bitbucket.org/X/Y -c Release.Prod -p x64 -s 7b479cdf3040f0e7f436d0e4baeff753aa5dc355
[Exec]
[Exec] Extracting embedded pdbstr.exe
[Exec] Using provider 'BitBucketProvider'
[Exec] No local repository is found in 'C:\TeamCity\buildAgent\work\f18fd9d2d9018dcf', creating a temporary one
[Exec] An unexpected error occurred | [NullReferenceException] System.NullReferenceException: Object reference not set to an instance of an object.
[Exec] at LibGit2Sharp.RemoteCallbacks.GitCredentialHandler(IntPtr& ptr, IntPtr cUrl, IntPtr usernameFromUrl, GitCredentialType credTypes, IntPtr payload)
[Exec] at LibGit2Sharp.Core.NativeMethods.git_clone(RepositorySafeHandle& repo, String origin_url, FilePath workdir_path, GitCloneOptions& opts)
[Exec] at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
[Exec] at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
[Exec] at GitTools.Git.GitPreparer.GetGitInfoFromUrl(IRepositoryContext context, String gitDirectory) in c:\CI_WS\Ws\78322\Source\GitTools_Core\src\GitTools.Core\Git\GitPreparer.cs:line 64
[Exec] at GitTools.Git.GitPreparer.Prepare(IRepositoryContext context, TemporaryFilesContext temporaryFilesContext) in c:\CI_WS\Ws\78322\Source\GitTools_Core\src\GitTools.Core\Git\GitPreparer.cs:line 27
[Exec] at GitLink.Providers.ProviderBase.GetShaHashOfCurrentBranch(Context context, TemporaryFilesContext temporaryFilesContext)
[Exec] at GitLink.Linker.Link(Context context)
[Exec]
[Exec] Completed in '00:00:00.6975423'
[Exec] C:\TeamCity\buildAgent\work\f18fd9d2d9018dcf\CI\GitLink.targets(4, 5): warning MSB3073: The command ""Tools\GitLink\GitLink.exe" "C:\TeamCity\buildAgent\work\f18fd9d2d9018dcf" -f \path\solution.sln -u https://bitbucket.org/X/Y -c Release.Prod -p x64 -s 7b479cdf3040f0e7f436d0e4baeff753aa5dc355" exited with code -1.
[Exec] The previous error was converted to a warning because the task was called with ContinueOnError=true.
[Exec] Build continuing because "ContinueOnError" on the task "Exec" is set to "true".
[Step 2/4] Process exited with code 0
Is there anything I can try?
Oh, it's obviously credentials. How do I pass them to GitLink? Or maybe it would be easier to use custom URL directly to https://bitbucket.org/X/Y/raw/{rest}?
For gitlink to clone the url, credentials are easy. But for the actual links (for example, to bitbucket), credentials are hard. For example, everyone should actually have their own credentials / authentication token when requesting the source.
I think some users succeeded in using powershell to authentication, but I never used it myself.