Skip to content

Commit 987ec4c

Browse files
Add ssh replacer to git config
1 parent ae8cc31 commit 987ec4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/functions/public/Git/Set-GitHubGitConfig.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@
5555
$token = $Context.Token | ConvertFrom-SecureString -AsPlainText
5656
$hostName = $Context.HostName
5757
$installationName = $Context.InstallationName
58+
$sshUser = $Context.Enterprise ?? 'git'
5859

5960
if ($PSCmdlet.ShouldProcess("$username on $installationName", 'Set Git configuration')) {
6061
$git = 'git'
6162
@(
6263
@('config', '--local', 'user.name', "$username"),
6364
@('config', '--local', 'user.email', "$id+$username@users.noreply.github.com"),
64-
@('config', '--local', "url.https://oauth2:$token@$hostName/$installationName.insteadOf",
65+
@('config', '--local', "url.`"https://oauth2:$token@$hostName/$installationName`".insteadOf",
6566
"https://$hostName/$installationName")
67+
@('config', '--local', "url.`"https://oauth2:$token@$hostName/$installationName`".insteadOf",
68+
"ssh://$sshUser@$hostName`:$installationName")
6669
) | ForEach-Object {
6770
Write-Verbose "$git $($_ -join ' ')"
6871
& $git $_

0 commit comments

Comments
 (0)