feat(auth): add SSH hostname prompting for self-hosted instances
Description
Adds interactive SSH hostname prompting during glab auth login for self-hosted GitLab instances. The prompt appears alongside the API hostname prompt, allowing users to configure a separate SSH hostname when needed (e.g., when an instance uses gitlab.example.com for HTTPS and ssh.gitlab.example.com for SSH).
Changes:
- Add SSH hostname prompt in three code paths:
- When user selects "Enter a different hostname" from detected hosts
- When user selects self-managed instance option
- When using
--hostnameflag in interactive mode
- Create
promptForSelfHostedInstance()helper to consolidate ~100 lines of duplicate code - Auto-detect SSH hostname from git remotes and pre-fill as suggestion
- Only store
ssh_hostconfig when different from main hostname - Support both
ssh://and SCP-style (git@host:path) remote URLs
User Experience:
- Only prompts for self-hosted instances (not gitlab.com)
- Groups hostname-related prompts together: hostname → API hostname → SSH hostname
- Detects existing SSH remotes and suggests the SSH hostname
Related Issues
Implements part of #8195
How has this been tested?
-
✅ All existing tests pass (2780 tests) -
✅ Manual testing of all three code paths -
✅ Verified SSH hostname detection works for both URL formats -
✅ Confirmed only prompts for self-hosted instances -
✅ Tested--hostnameflag with interactive mode