Cursor is a lightning-fast, AI-powered code editor. GitHub Codespaces gives you a prebuilt cloud dev environment. Connecting the two gives you the power of a cloud IDE with the feel of a local editor.
Hereâs how to set them up to work together â and what to do when it doesnât work.
â What youâll get
Use Cursor to edit code inside a live GitHub Codespace
Push to GitHub, deploy, run, test â all from within Cursor
No fake "remote folders", this is the actual Codespace
đ Step 2: Generate SSH config for your Codespace
Run this:
gh codespace ssh --config
This outputs a block like:
Host cs.friendly-mongoose-xyz.main
User vscode
ProxyCommand /usr/local/bin/gh cs ssh -c friendly-mongoose-xyz --stdio ---i /Users/you/.ssh/codespaces.auto
IdentityFile /Users/you/.ssh/codespaces.auto
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
ControlMaster auto
LogLevel quiet
âď¸ Step 3: Add it to your SSH config
Append it to your SSH config file:
gh codespace ssh --config >> ~/.ssh/config
This tells SSH (and Cursor) how to connect to your running Codespace.
đ§ Step 4: Fix Cursorâs Remote SSH settings
By default, Cursor may look at the wrong SSH config file.
Cmd+Shift+P â type Remote-SSH: Settings
This is essential. If it points to something like ~/.ssh/devboxes, you wonât see any Codespaces listed.
Change SSH config path to:
~/.ssh/config
I had to change my settings from ~/.ssh/devboxes (no such file exists) to ~/.ssh/config (which is the file we made/updated in the last step).
đ Step 5: Connect
Cmd+Shift+P â Remote-SSH: Connect to HostâŚ
Youâll now see your Codespace (e.g. cs.friendly-mongoose-xyz.main)
Click it â you're in đ
Youâre now running Cursor connected over SSH to your GitHub-hosted Codespace.
đ ď¸ Troubleshooting
â 1. "No Codespaces appear" in Connect to HostâŚ
Fix: Make sure Cursor is looking at the correct config file (~/.ssh/config), not ~/.ssh/devboxes.
Cmd-Shift-P, select âConnect to HostâŚâ
By the end of this guide, youâll be able to select your GitHub codespace as an option.
If you donât see your codespace
Â
A - Cmd-Shift-P âRemote - SSH settingsâ
Check that itâs reading the correct local ssh config file.
B - [not sure if this step is necessary]
Try starting the codespace (on GitHub.com/codespaces or in VS Code), or Ensure itâs running with gh codespace list.
Â
â 2. "Permission denied" or "403 Unauthorized" errors from gh
The GitHub CLI may be missing required scopes. Run:
Then rebuild the container (Cmd+Shift+P â "Rebuild Container").
â 4. âWhereâs my code?â after connecting
Once connected, run:
ls /workspaces
cd /workspaces/your-repo-name
Thatâs where GitHub mounts your codebase inside the container.
You can also click âOpen Folderâ and browse to /workspaces/your-repo-name.
Â
â ď¸ Do NOT accidentally attempt your old âconnect to codespaceâ flow.
Â
Â
Instead, click âFile â Open folderâ.
Type âworkspacesâ.
Select your project within (mine is called awe2023 )
Â
In my case, thatâs /workspaces/awe2023 ââOKâ
Â
In terms of folder structure, I first arrived into home/vscode/
the workspaces/ folder is a sibling folder of home/
$ pwd
/home/vscode
@markitics â ~ $ ls
@markitics â ~ $ ls ../..
bin dev home lib64 mnt proc run srv tmp var workspaces
boot etc lib media opt root sbin sys usr vscode
@markitics â ~ $ cd ../../workspaces/
@markitics â /workspaces $ ls
awe2023
@markitics â /workspaces $ cd awe2023/
Â
â 5. âDev Containerâ popup: dismiss
If you get this pop-up in the bottom left corner, dismiss it:
Youâre already SSHâd into the running container via Cursor. If you click âReopen in Container,â Cursor will try to create a new Docker container inside the Codespace, which isnât what you want, probably wonât work cleanly, wIâll break the current setup.
Â
Â
Â
đ§ Under the Hood
The gh CLI handles OAuth, SSH key generation, and Codespace access.
Cursor (like VS Code) uses the Remote - SSH plugin and reads from ~/.ssh/config
The Codespace itself runs an SSH server, enabled via the sshd feature
codespaces.auto is the default key GitHub generates for SSH access â you donât need to create your own
The original motivation that âhm, maybe I can indeed do it with the âRemote - SSHâ plugin was this helpful blog post by @NFAblog.
â Summary
Now youâre using Cursor + GitHub Codespaces like a pro. Fast local editing with real cloud compute.
Â
Â
About this post
Most of the above blog post was written by ChatGPT and I havenât proof-read it in detail. I (Mark Moriarty) can confirm I did get Cursor working for me, can get Cursor composer to suggest and implement edits, I can git push after Iâve committed changes, and I can eb deploy to deploy an updated app to Elastic Beanstalk. (I had to manually install awscli, eb cli, and I customised my ~/.git/config to include personalized shortcuts).