12
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2026-05-22 12:01:53 +00:00

feat: support custom SSH user in git auth configuration

- Allow sshUser setting to override default 'git' user in insteadOf config
- When sshUser is empty, default to 'git@github.com'
- When sshUser is provided (e.g., 'customuser'), use 'customuser@github.com'
- Updated tests to verify custom SSH user behavior in auth configuration

Co-Authored-By: Claude:Qwen3-Coder-Next-4bit
This commit is contained in:
axi92 2026-05-19 17:04:51 +02:00
parent 900f2210b1
commit ed390c1672
No known key found for this signature in database
GPG key ID: 002E8A5947CA5DB8
3 changed files with 94 additions and 2 deletions

View file

@ -65,7 +65,11 @@ class GitAuthHelper {
// Instead of SSH URL
this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf` // "origin" is SCHEME://HOSTNAME[:PORT]
this.insteadOfValues.push(`git@${serverUrl.hostname}:`)
const sshUser =
this.settings.sshUser && this.settings.sshUser.length > 0
? this.settings.sshUser
: 'git'
this.insteadOfValues.push(`${sshUser}@${serverUrl.hostname}:`)
if (this.settings.workflowOrganizationId) {
this.insteadOfValues.push(
`org-${this.settings.workflowOrganizationId}@github.com:`