在通过 Git-CLI 创建存储库时,如何将 gitignore file and license 设置为 None 并将 add "origin" git remote 全部设置为 Yes?

How to set gitignore file and license to None and set add "origin" git remote to Yes all at once when creating a repo via Git-CLI?

当我使用

创建新的存储库时
gh repo create My_Repo

系统提示我提出以下问题

? 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)

我想在一个命令中管理所有 4 个问题。

我尝试了以下方法

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

它给了我以下输出

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.

我试过gh repo create My_Repo --public -g None -l None它也导致同样的错误。

我也想绕过这个问题

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

我该怎么做?

我希望在一个命令中给出以下答案

? 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

此外,是否可以在单个命令中包含以下内容?

gitignore = Python | license = None | add to "origin" = Yes
gitignore = None | license = MIT License | add to "origin" = Yes

我给你4个选项

  1. 使用以下选项创建存储库
  • --public

  • --gitignore None

  • --许可证None

  • 添加到“来源”是

     gh repo create MyRepo --public -y
    
  1. 使用
  2. 创建一个仓库
  • gitignore = Python

  • 许可证=None

     gh repo create MyRepo --public -g Python -y
    
  1. 使用
  2. 创建一个仓库
  • gitignore = None

  • license = MIT 许可证

     gh repo create MyRepo --public -l MIT -y
    
  1. 使用
  2. 创建一个仓库
  • gitignore = Python

  • license = MIT 许可证

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

每当你想包含一个 gitignore 模板时 select 模板并使用 TitleCase 输入名称。这是所有可用的 gitignore 模板的 link -> Link.