Skip to content

gh repo create prevents empty description when pushing an existing local repository #7377

Closed

Description

@vwkd

Describe the bug

When creating a new repository from an existing local repository, gh repo create defaults to use the repository name if the description is left empty. This prevents to use an empty description. Note, inserting an empty string "" creates a description with "".

A workaround is to open the repository in the Web browser after it was created and delete the description again.

This behavior differs from creating a new repository from scratch, where the description defaults to empty.

Steps to reproduce the behavior

  1. Run gh repo create in a new git repository
  2. Choose Push an existing local repository to GitHub
  3. Press Enter
  4. Press Enter
  5. Press Enter
  6. Observe the description entered in step 6. is the repository name.

Expected vs actual behavior

Actual behavior: description defaults to repository name

➜  foo git:(main) gh repo create
? What would you like to do? Push an existing local repository to GitHub
? Path to local repository .
? Repository name foo
? Description (foo)

Expected behavior: description defaults to empty

➜  foo git:(main) gh repo create
? What would you like to do? Push an existing local repository to GitHub
? Path to local repository .
? Repository name foo
? Description

Also compare this to the behavior when creating a new repository from scratch, where the description defaults to empty.

➜  foo gh repo create
? What would you like to do? Create a new repository on GitHub from scratch
? Repository name bar
? Description

Logs

gh version 2.27.0 (2023-04-07)

Activity

  1. added
    bugSomething isn't working
    on Apr 27, 2023
  2. changed the title [-]`gh repo create` defaults to repository name for empty description when pushing an existing local repository[/-] [+]`gh repo create` prevents empty description when pushing an existing local repository[/+] on Apr 27, 2023
  3. vwkd commented on Apr 30, 2023

    @vwkd
    ContributorAuthor

    Digging around a bit, it seems the repository name as default description when creating from a local repository is set in the call prompter.Input("Description", defaultName) in /pkg/cmd/repo/create/create.go#LL733.

  4. added
    priority-3Affects a small number of users or is largely cosmetic
    and removed on Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions