cli / cli/cli

gh cs cp remote: does not resolve remote paths unless `-e` flag is provided

Open
#11,712 3 comments 0 reactions 0 assignees View on GitHub
bug gh-codespace priority-2
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Describe the bug

If I run this:

```shellsession
$ gh cs cp -c ominous-space-journey-wv6jg4qrqh5xqq remote:/workspaces/github/Gemfile Gemfile
/usr/bin/scp: '/workspaces/github/Gemfile': No such file or directory
shell closed: exit status 1
```

I know the file exists, though. In order to copy it, instead I need to run this:

```
$ gh cs cp -e -c ominous-space-journey-wv6jg4qrqh5xqq remote:/workspaces/github/Gemfile Gemfile
/usr/bin/scp: '/workspaces/github/Gemfile': No such file or directory
shell closed: exit status 1
```

The help for `cs cp` describes the `-e` flag as "-e, --expand Expand remote file names on remote shell" which in my mind, at least, means expanding `~` and environment variables. However, I am providing absolute paths with no variables.

### Affected version

```shellsession
$ gh version
gh version 2.76.2 (2025-07-30)
https://github.com/cli/cli/releases/tag/v2.76.2
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.