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

Error: could not find commit hash for master #16

Closed
daniellockyer opened this issue Nov 18, 2020 · 4 comments
Closed

Error: could not find commit hash for master #16

daniellockyer opened this issue Nov 18, 2020 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@daniellockyer
Copy link

daniellockyer commented Nov 18, 2020

degit defaults to master for cloning, but new GitHub repositories use main as the default branch. I just set up a new repo and tried to use ghat, but get the following error:

(node:95712) UnhandledPromiseRejectionWarning: Error: could not find commit hash for master
    at Degit._cloneWithTar (/home/neo/ghat/node_modules/degit/dist/index-26d8486e.js:15037:10)
    at async Degit.clone (/home/neo/ghat/node_modules/degit/dist/index-26d8486e.js:14878:4)
    at async ghat (/home/neo/ghat/lib.js:63:2)
    at async /home/neo/ghat/bin.js:32:4

I could change the default branch of my repo, but I was wondering if you had a better solution?

Reproduction

  1. Set up a new GitHub repo for templates
  2. Try and use ghat elsewhere with this template repo
  3. See the following error: Error: could not find commit hash for master

ghat version: v0.11.1

@HugoDF
Copy link

HugoDF commented Nov 18, 2020

Looks like it's an upstream error from Rich-Harris/degit#207 (comment)

workaround is to do username/repo#main

Edit: that issue + some PRs to fix it look stale, maybe this is something that should be handled in this project

@fregante
Copy link
Owner

Thanks for trying and reporting! Being a previous Rollup collaborator (ish), I had pinged @Rich-Harris to possibly becoming a maintainer of degit but I haven't received an answer yet.

Handling it here probably means doing a preflight request to GitHub to find the branch

@fregante fregante added bug Something isn't working help wanted Extra attention is needed labels Nov 18, 2020
@fregante
Copy link
Owner

This was a major oversight on my part since I expect ghat users to create new repos, which would now likely use main

I patched the latest version until a proper default branch detection is implemented, hopefully in degit.

@daniellockyer
Copy link
Author

@fregante Perfect, thanks! 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants