2

When I create a new repo using

gh repo create My_Repo

I am prompted with the following questions

? Visibility
? Would you like to add a .gitignore? (y/N)
? Would you like to add a license? (y/N)
? This will add an "origin" git remote to your local repository. Continue? (Y/n)

I would like to manage all the 4 questions in a single command.

I tried the following

gh repo create My_Repo --public -g No -l No
? This will create the "My_Repo" repository on GitHub. Continue? (Y/n)

It gives me the following output

HTTP 422: Repository creation failed. (https://api.github.com/user/repos)
gitignore_template is an unknown gitignore template.
license_template is an unknown license template.

I tried gh repo create My_Repo --public -g None -l None it also results in the same error.

Also I would like to bypass the question

? This will create the "My_Repo" repository on GitHub. Continue? (Y/n)

How do I do that?

I am looking to give the following answers in a single command

? Visibility --public
? Would you like to add a .gitignore? ====> No
? Would you like to add a license? ====> No
? This will add an "origin" git remote to your local repository. Continue? ====> Yes

Also, is it possible to include the following in a single command?

gitignore = Python | license = None | add to "origin" = Yes
gitignore = None | license = MIT License | add to "origin" = Yes
torek
  • 448,244
  • 59
  • 642
  • 775
CodingRaz
  • 123
  • 8

1 Answers1

4

I will give you all the 4 options

  1. To create a repo with the following options
  • --public

  • --gitignore None

  • --license None

  • add to "origin" Yes

     gh repo create MyRepo --public -y
    
  1. To create a repo with
  • gitignore = Python

  • license = None

     gh repo create MyRepo --public -g Python -y
    
  1. To create a repo with
  • gitignore = None

  • license = MIT License

     gh repo create MyRepo --public -l MIT -y
    
  1. To create a repo with
  • gitignore = Python

  • license = MIT License

     gh repo create MyRepo --public -g Python -l MIT -y
    

Whenever you want to include a gitignore template select the template and enter the name with TitleCase. Here is a link to all the available gitignore templates -> Link.

SohailAQ
  • 1,002
  • 1
  • 13
  • 25