[BUG] --teleport fails with custom SSH host aliases in git remote URLs

Status Closed — not planned
Maintainer reply None cached
Activity 12 comments · opened Nov 6, 2025 · closed Mar 1, 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?

When using a custom SSH host alias in git remote URLs (e.g., github-personal:user/repo), the --teleport command fails with a misleading error message.

What Should Happen?

Teleport should work regardless of the SSH host alias used in the git remote URL.

Error Messages/Logs

You must run claude --teleport session_[xxx] from a checkout of [user]/[repo].

Parts with square brackets were are generic strings because I wished to redact the real versions.

Steps to Reproduce

  1. Configure SSH config with a custom GitHub alias:
Host github-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
  1. Clone a repo using this alias: git clone github-personal:user/repo
  2. Have claude code web work on an issue in the same repository and use the "Open in CLI" button
  3. Attempt to use teleport: claude --teleport session_xxx

Current Workaround:

Add a standard github.com remote alongside the custom alias.

Suggested Fix:

  • Parse SSH config to resolve aliases to their actual HostName
  • Or provide a configuration option to specify accepted remote patterns
  • Improve error message to indicate the issue is with remote URL format, not repository location

Why This Matters:

Custom SSH host aliases are a common practice for:

  • Managing multiple GitHub accounts (work/personal)
  • Ensuring commits use the correct user identity
  • Other SSH configuration needs

The current behavior blocks legitimate use cases with an unhelpful error message that suggests the user isn't in the correct directory when they actually are.

Claude Model

Irrelevant as it is a command issue

Is this a regression?

I don't know

Last Working Version

Unknown. I suspect this has never worked

Claude Code Version

2.0.34 (Claude Code)

Platform

Anthropic API

Operating System

Likely Irrelevant: Ubuntu/Debian Linux

Terminal/Shell

Likely Irrelevant: Gnome Terminal

View original on GitHub ↗

12 Comments

cnighswonger · 9 months ago

Reference this comment on #11139.

gerrywastaken · 9 months ago

Same bug when you try to send a job to Claude Code web via the new background job (&) operator

  ⎿ Cannot launch remote Claude Code session.

    Background tasks require a git repository. Initialize git or run from a git repository.

<img width="1188" height="166" alt="Image" src="https://github.com/user-attachments/assets/d6e57974-efe2-4b5e-9c61-80e7aada44c1" />

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

cnighswonger · 8 months ago

Come on people.

smithi1 · 8 months ago

I have had this issue on MacOS when using teleport, so it also exists there.

robbintt · 7 months ago

Hit this issue on macos. Needs an integration test... no need to check hardcoded remotes.

danielolamide · 7 months ago

@gerrywastaken you mention a workaround to add a new remote alongside the SSH remote - what would that look like?

simiondolha · 7 months ago

still the same in windows

gerrywastaken · 7 months ago

@danielolamide
Just:
git remote add origin git@github.com:<gh_username>/<repo>.git

It looks for a github.com remote and will fail otherwise.
if you need to use a specific key you gotta add that in your ~/.ssh/config

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/<private_key>
    IdentitiesOnly yes

replace all the things in angle brackets < and >

This does mean you can't assign another key as the default for github.com, which is sill annoying. :/

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

ariccb-webvar · 5 months ago

I'm still having this issue

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.