@@ -231,14 +231,20 @@ export class RemoteClient {
231231 throw new Error ( 'GIT_PRIVATE_TOKEN is not available' ) ;
232232 }
233233
234+ // Clear any existing URL configurations
235+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."https://github.com/".insteadOf` ) ;
236+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."ssh://git@github.com/".insteadOf` ) ;
237+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."git@github.com".insteadOf` ) ;
238+
239+ // Set new URL configuration with token
234240 await CloudRunnerSystem . Run (
235- `git config --global --replace-all url."https://token: ${ gitPrivateToken } @github.com/".insteadOf ssh ://git@ github.com/` ,
241+ `git config --global url."https://${ gitPrivateToken } @github.com/".insteadOf "https ://github.com/" ` ,
236242 ) ;
237243 await CloudRunnerSystem . Run (
238- `git config --global --add url."https://token: ${ gitPrivateToken } @github.com/".insteadOf git@github.com` ,
244+ `git config --global url."https://${ gitPrivateToken } @github.com/".insteadOf "ssh:// git@github.com/" ` ,
239245 ) ;
240246 await CloudRunnerSystem . Run (
241- `git config --global --add url."https://token: ${ gitPrivateToken } @github.com/".insteadOf "https:// github.com/ "` ,
247+ `git config --global url."https://${ gitPrivateToken } @github.com/".insteadOf "git@ github.com"` ,
242248 ) ;
243249
244250 await CloudRunnerSystem . Run ( `git lfs pull` ) ;
@@ -255,15 +261,20 @@ export class RemoteClient {
255261 throw new Error ( 'GITHUB_TOKEN is not available as fallback' ) ;
256262 }
257263
258- // Configure git to use GITHUB_TOKEN
264+ // Clear any existing URL configurations
265+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."https://github.com/".insteadOf` ) ;
266+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."ssh://git@github.com/".insteadOf` ) ;
267+ await CloudRunnerSystem . Run ( `git config --global --unset-all url."git@github.com".insteadOf` ) ;
268+
269+ // Set new URL configuration with token
259270 await CloudRunnerSystem . Run (
260- `git config --global --replace-all url."https://token: ${ githubToken } @github.com/".insteadOf ssh ://git@ github.com/` ,
271+ `git config --global url."https://${ githubToken } @github.com/".insteadOf "https ://github.com/" ` ,
261272 ) ;
262273 await CloudRunnerSystem . Run (
263- `git config --global --add url."https://token: ${ githubToken } @github.com/".insteadOf git@github.com` ,
274+ `git config --global url."https://${ githubToken } @github.com/".insteadOf "ssh:// git@github.com/" ` ,
264275 ) ;
265276 await CloudRunnerSystem . Run (
266- `git config --global --add url."https://token: ${ githubToken } @github.com/".insteadOf "https:// github.com/ "` ,
277+ `git config --global url."https://${ githubToken } @github.com/".insteadOf "git@ github.com"` ,
267278 ) ;
268279
269280 await CloudRunnerSystem . Run ( `git lfs pull` ) ;
0 commit comments