You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh repo rename myorg/newname results in myorg/myorg-newname #10034
Interesting! Thanks for the bug report. What's happening here is that the CLI is echoing your argument (which looks correct - but isn't, because repo rename doesn't expect an org in the name) but the API is converting the / to a -. Here's the API request body for a command I ran:
What we should probably do here is 1. document this more clearly in the help text 2. error if there is a / in the name. We could check if the name matches the org and ignore it but I don't know if it's that much better than just failing and introduces a bit of not-very-high-value maintenance and UX debt.
@williammartin I think this help doc change is important since this seems to come up from time to time. I opened a PR for this - it also includes a proposal for a small change to the prompt: #10044
Interesting! Thanks for the bug report. What's happening here is that the CLI is echoing your argument (which looks correct - but isn't, because repo rename doesn't expect an org in the name) but the API is converting the / to a -. Here's the API request body for a command I ran:
What we should probably do here is 1. document this more clearly in the help text 2. error if there is a / in the name. We could check if the name matches the org and ignore it but I don't know if it's that much better than just failing and introduces a bit of not-very-high-value maintenance and UX debt.
I hesitate on the level of intelligence that gh should exhibit here since the GitHub API is already doing some. It doesn't appear we have any repository name validation in the code base even for repository creation outside of splitting on slashes:
Given I have a repo org/repo When I run gh repo -R org/repo rename org/repo-rename Then the CLI exits 1 And Then I see an informative error message on stderr that the renamed repository should not contain forward slashes, and a hint that if the user is trying to move the repository between organisations they need to read the docs, with a link.
Activity
williammartin commentedon Dec 7, 2024
Interesting! Thanks for the bug report. What's happening here is that the CLI is echoing your argument (which looks correct - but isn't, because
repo renamedoesn't expect an org in the name) but the API is converting the/to a-. Here's the API request body for a command I ran:What we should probably do here is 1. document this more clearly in the help text 2. error if there is a
/in the name. We could check if the name matches the org and ignore it but I don't know if it's that much better than just failing and introduces a bit of not-very-high-value maintenance and UX debt.BagToad commentedon Dec 8, 2024
Linking in a few related issues:
ghto transfer ownership of repo from one org to another #5292 (loosely related)BagToad commentedon Dec 8, 2024
@williammartin I think this help doc change is important since this seems to come up from time to time. I opened a PR for this - it also includes a proposal for a small change to the prompt: #10044
andyfeller commentedon Dec 9, 2024
I hesitate on the level of intelligence that
ghshould exhibit here since the GitHub API is already doing some. It doesn't appear we have any repository name validation in the code base even for repository creation outside of splitting on slashes:cli/pkg/cmd/repo/create/create.go
Lines 914 to 963 in 46bba45
cli/internal/ghrepo/repo.go
Lines 44 to 58 in 46bba45
Since the underlying
cli/go-ghlogic assumes the slashes are for[HOST/]OWNER/REPO, I think the safest things to do are:/eviltimrogers commentedon Jan 28, 2025
I'd definitely agree that it feels like the right way forward to error if a repository name is entered beginning with
/.williammartin commentedon Feb 3, 2025
Acceptance Criteria
Given I have a repo
org/repoWhen I run
gh repo -R org/repo rename org/repo-renameThen the CLI exits 1
And Then I see an informative error message on stderr that the renamed repository should not contain forward slashes, and a hint that if the user is trying to move the repository between organisations they need to read the docs, with a link.
Randy88-art commentedon Aug 17, 2025
Duplicate of #10466