Search code examples
githubterminalgitignoregithub-cli

How to specify --gitignore argument in gh repo create cli command?


I'm trying to create remote repository using GitHub CLI and I can not find how to specify a particular gitignore file with argument --gitignore, say, github/gitignore/C++.gitignore. There is an error HTTP 422: Repository creation failed. (https://api.github.com/user/repos) gitignore_template is an unknown gitignore template.

Unsuccessfully have been trying to find an example on internet and stackoverflow also.


Solution

  • This feature was implemented with PR 3746 for gh v1.12.0 (Q2 2021).

    It is supposed to use only one word for the gitignore parameter.
    Example:

    gh repo create my-repo-name --gitignore Go --license mit --public
    

    In your case, try --gitignore C++ or --gitignore Cpp.