Agent cannot run git push or other authenticated commands — no access to user credentials

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The AI agent in Cursor can run terminal commands, but it cannot run git push, gh pr create, or any command that needs my SSH keys, credential helper, or logged-in session. The agent runs in an environment that doesn’t have access to my credentials.

From my perspective as a user, that’s a bug, not a feature. I’m using an AI-powered coding IDE; I expect the agent to be able to do normal dev workflows like pushing a branch or opening a PR. Instead I have to copy commands from the agent and run them myself in a separate terminal. Other AI coding tools (e.g. Claude, Codex) don’t impose this limitation in the same way.

Please give the agent a way to run authenticated git/gh operations in a context that has access to the user’s credentials (e.g. the user’s default shell environment or an opt-in “trusted” execution context), or document clearly why it’s impossible and what the supported workflow is.

Steps to Reproduce

Open Cursor IDE and start a conversation with the AI agent (e.g. Chat or Composer).
Do something that requires pushing to a remote (e.g. create a branch, make a commit, or ask the agent to “push my branch” or “open a PR”).
Let the agent run the commands (or ask it to run git push or gh pr create).
Observe: the agent either does not run the command, says it can’t run it, or runs it in an environment where it fails due to missing SSH/credentials.

Expected Behavior

When I ask the agent to push a branch or run other authenticated git/gh commands (e.g. git push, gh pr create), it should run them in an environment that has access to my credentials (SSH keys, credential helper, or gh auth) so the push or PR creation succeeds. Alternatively, the agent could run the command in my own terminal/shell where I am already authenticated. I expect an AI coding assistant in my IDE to support normal workflows like pushing and opening PRs without me having to copy the command and run it manually elsewhere.

Operating System

Windows 10/11
Linux

Version Information

Version: 2.4.28 (system setup)
VSCode Version: 1.105.1
Commit: f3f5cec40024283013878b50c4f9be4002e0b580
Date: 2026-02-03T00:56:18.293Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

Model name: Auto

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the report.

On native Windows, the agent runs commands in your shell, so your credentials should be available. A few questions to narrow this down:

  1. Are you on native Windows or WSL?
  2. When the agent tries to run git push, does it refuse to run the command, or does it run and then fail with an error? If there is an error, please send the exact message.
  3. Does git push work from Cursor’s built-in terminal (not the agent, just the normal terminal panel)?

This will help us figure out whether this is agent-specific or a more general terminal environment issue.

Hey, sorry for missing this critical piece of information in the description: yes I’m running cursor from WSL. Curiously enough, running from the same WSL environment, from cursor, through extensions, I can run git commands with claude. codex and gemini, so even though it might be related to the WSL setup, its also cursor-related.

So, in a nutshell:

1.Are you on native Windows or WSL? – WSL

  1. When the agent tries to run git push, does it refuse to run the command, or does it run and then fail with an error? If there is an error, please send the exact message.

– Error message:
hostkeys_find_by_key_hostfile: hostkeys_foreach failed for /root/.ssh/known_hosts: Permission denied
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

  1. Does git push work from Cursor’s built-in terminal (not the agent, just the normal terminal panel)?

Yes. git push works from Cursor’s built-in terminal (the normal terminal panel). I use the same repo, same remotes, and the same credentials there, and push succeeds. The failure only happens when the agent runs git push (e.g. via Composer/Chat). So the problem is the agent’s execution context (no SSH/credentials), not git, the repo, or my setup.

The "/root/.ssh/known_hosts: Permission denied" error suggests the agent is running with different permissions than your normal terminal.

Can you run these commands both in the agent terminal and in the regular terminal panel, then compare the output?

whoami
echo $SSH_AUTH_SOCK
ls -la /root/.ssh/known_hosts

For now, try turning on Legacy Terminal Tool (Cursor Settings > Agents) and restart. It uses a different execution path that might correctly inherit your WSL environment.

Let me know what the commands show.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.