@@ -170,12 +170,35 @@ private void PackageInstall()
170
170
171
171
Log < CodeQLInstallation > . G ( ) . LogInformation ( $ "Checkout standard library into.. { StdLibDirectory } ") ;
172
172
173
- var repoPath = Repository . Clone ( "https://github.com/github/codeql.git" , StdLibDirectory ) ;
174
-
173
+ // Use direct git command to clone the repository to avoid LibGit2Sharp
174
+ // issues with SSH URL rewriting in Git configuration
175
+ using ( Process gitProcess = new Process ( ) )
176
+ {
177
+ gitProcess . StartInfo . FileName = "git" ;
178
+ gitProcess . StartInfo . WorkingDirectory = InstallationDirectory ;
179
+ gitProcess . StartInfo . UseShellExecute = false ;
180
+ gitProcess . StartInfo . RedirectStandardOutput = true ;
181
+ gitProcess . StartInfo . RedirectStandardError = true ;
182
+ gitProcess . StartInfo . Arguments = $ "clone https://github.com/github/codeql.git { Path . GetFileName ( StdLibDirectory ) } ";
183
+
184
+ gitProcess . Start ( ) ;
185
+ string output = gitProcess . StandardOutput . ReadToEnd ( ) ;
186
+ string error = gitProcess . StandardError . ReadToEnd ( ) ;
187
+ gitProcess . WaitForExit ( ) ;
188
+
189
+ if ( gitProcess . ExitCode != 0 )
190
+ {
191
+ Log < CodeQLInstallation > . G ( ) . LogError ( $ "Git clone failed with exit code { gitProcess . ExitCode } ") ;
192
+ Log < CodeQLInstallation > . G ( ) . LogError ( $ "Output: { output } ") ;
193
+ Log < CodeQLInstallation > . G ( ) . LogError ( $ "Error: { error } ") ;
194
+ throw new Exception ( $ "Failed to clone CodeQL standard library repository: { error } ") ;
195
+ }
196
+ }
175
197
176
198
Log < CodeQLInstallation > . G ( ) . LogInformation ( $ "Getting standard library version.. { StandardLibraryVersion } ") ;
177
199
178
- using ( var repo = new Repository ( repoPath ) )
200
+ // Now use LibGit2Sharp to checkout the specific version since the repo is already cloned
201
+ using ( var repo = new Repository ( StdLibDirectory ) )
179
202
{
180
203
var tag = repo . Tags [ $ "refs/tags/{ StandardLibraryVersion } "] ;
181
204
0 commit comments