Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookiecutter fails if gh is not installed #220

Open
cwren-usds opened this issue Dec 17, 2024 · 2 comments
Open

cookiecutter fails if gh is not installed #220

cwren-usds opened this issue Dec 17, 2024 · 2 comments

Comments

@cwren-usds
Copy link

Description
cookiecutter fails if gh is not installed.

To Reproduce
Steps to reproduce the behavior:

  1. cookiecutter https://github.com/DSACMS/repo-scaffolder --directory=tier1
  2. answer true to "Would you like to create a repo on github.com?'
  3. See error

Expected behavior
It would be nice if the error message was more clear, or better yet if all the dependencies were checked before the user types in a bunch of information that will be lost on failure.

Desktop (please complete the following information):

  • OS: Darwin WM36Q4724H 23.6.0 Darwin Kernel Version 23.6.0: Fri Nov 15 15:13:15 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T6000 arm64

Additional context

Traceback (most recent call last):
  File "/var/folders/xd/xmml7vrs08j8sxz6vlnx23k00000gp/T/tmp5qwyg5xa.py", line 56, in <module>
    main()
    ~~~~^^
  File "/var/folders/xd/xmml7vrs08j8sxz6vlnx23k00000gp/T/tmp5qwyg5xa.py", line 48, in main
    createGithubRepo()
    ~~~~~~~~~~~~~~~~^^
  File "/var/folders/xd/xmml7vrs08j8sxz6vlnx23k00000gp/T/tmp5qwyg5xa.py", line 21, in createGithubRepo
    subprocess.call(gh_cli_command)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 395, in call
    with Popen(*popenargs, **kwargs) as p:
         ~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1036, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        pass_fds, cwd, env,
                        ^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
                        gid, gids, uid, umask,
                        ^^^^^^^^^^^^^^^^^^^^^^
                        start_new_session, process_group)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1966, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gh'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
@cwren-usds
Copy link
Author

ah of course, I had not actually logged into gh so it failed after install this way:

To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.

@cwren-usds
Copy link
Author

it occurs to me that this is a bug for cookiecutter, not repo-scaffolder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant