[BUG] Remote sessions fail with custom SSH aliases (insteadOf gitconfig)

Resolved 💬 2 comments Opened Feb 3, 2026 by NateSchneider Closed Mar 4, 2026

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

  1. Set up multiple GitHub accounts with SSH aliases:

``bash
# In ~/.gitconfig
[url "git@github-personal:USERNAME/"]
insteadOf = git@github.com:USERNAME/
``

  1. Clone a repo (remote gets rewritten by insteadOf)
  1. Verify git works fine:

``bash
git status # works
git pull # works
``

  1. Try to launch a remote session:

``
& echo hello
``

  1. 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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗