gh 2.21.0 (Dec. 2022) adds two new elements:
- Use
-R
for --repo
shorthand and deprecate -r
gh codespace create
: allow setting display name for the new codespace.
So:
cd /path/to/current/local/repository
gh repo set-default
gh codespace create -R $(gh repo view --json owner,name --jq '"\(.name)/\(.owner.login)"') \
--display-name yourName
See "Github CLI add another remote and work with it" on the new necessity to define your current repository as the default one.
See gh
formatting on --json --jq
formatting options, which allows to extract owner/name
from the current repository:
gh repo view --json owner,name --jq '"\(.name)/\(.owner.login)"'
# on CMD Windows
gh repo view --json owner,name --jq "\"\(.name)/\(.owner.login)\""