[BUG] Remote sessions fail with custom SSH aliases (insteadOf gitconfig)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Remote/background sessions fail with "Background tasks require a git repository" when using custom SSH aliases via git's url.<base>.insteadOf configuration. This is a common setup for developers with multiple GitHub accounts (personal/work).
Environment
- OS: macOS 15 (Darwin 25.2.0)
- Claude Code: Latest
The Problem
When using SSH aliases for multiple GitHub profiles, git remote -v displays the alias hostname instead of github.com:
$ git remote -v
origin git@github-personal:user/repo.git (fetch)
origin git@github-personal:user/repo.git (push)
However, the actual remote URL in git config is standard:
$ git config remote.origin.url
git@github.com:user/repo.git
The insteadOf rule rewrites the display:
$ git config --get-regexp 'url.*insteadof'
url.git@github-personal:user/.insteadof git@github.com:user/
Claude Code's URL parser sees github-personal and fails to recognize it as a GitHub repository.
Note: Temporarily removing the insteadOf config does NOT fix the issue - the error persists even with a standard remote URL format.
Root Cause
The remote session launcher appears to have issues parsing git remotes when custom SSH configurations are present, even after removing the alias rewrites.
What Should Happen?
Claude Code should recognize repositories with custom SSH aliases as valid GitHub repositories and allow remote session launching.
Error Messages/Logs
& echo hello
⎿ Cannot launch remote Claude Code session.
Background tasks require a git repository. Initialize git or run from a git repository.
Steps to Reproduce
- Set up multiple GitHub accounts with SSH aliases:
``bash``
# In ~/.gitconfig
[url "git@github-personal:USERNAME/"]
insteadOf = git@github.com:USERNAME/
- Clone a repo (remote gets rewritten by insteadOf)
- Verify git works fine:
``bash``
git status # works
git pull # works
- Try to launch a remote session:
````
& echo hello
- Observe error about missing git repository
Workaround
None found. Removing the insteadOf config and resetting the remote URL to standard format does not resolve the issue.
Related Issues
This is related to #13087 which was closed as resolved, but this specific case (insteadOf aliases / multi-account SSH setups) appears to still be broken.
Claude Model
Opus 4.5
Is this a regression?
Unknown
Claude Code Version
Latest
Platform
Max subscription
Operating System
macOS
Terminal/Shell
zsh
Additional Information
Multi-account GitHub setups with SSH aliases are very common among developers who contribute to both personal and work repositories. This configuration pattern is recommended by GitHub's own documentation for managing multiple accounts.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗