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" #37

Open
docmars opened this issue Oct 4, 2018 · 25 comments

Comments

@docmars
Copy link

commented Oct 4, 2018

Hey there—I'm trying to get started with Svelte and running:

Environment:

  • macOS 10.14 Mojave
  • Node v8.11.4
  • degit v2.1.3

Running:

degit sveltejs/template-webpack

... gives me:

! could not find commit hash for master

Double checking that the user/repo is correct, I'm not really sure why it can't find the hash. I tried it with a couple other repos out there and no-go.

Any ideas?

@docmars

This comment has been minimized.

Copy link
Author

commented Oct 4, 2018

Well derp, I was trying to run this on a new Macbook Pro that I hadn't installed Xcode or the Command Line Tools on, so git wasn't ready to go yet. Now that it's installed, I tried degit again and everything worked like a charm.

It may be pertinent in the rare cases when people don't have git properly configured (who even does that?!) that degit properly pass any errors along that may occur like this.

@paulocoghi

This comment has been minimized.

Copy link

commented Oct 12, 2018

Would be interesting if degit doesn't depend on git to work. I was trying to figure out for weeks why some team mates had the same issue. 😄

@Webzeugmacher

This comment has been minimized.

Copy link

commented Nov 24, 2018

git update helped on windows 10

@oliverjanik

This comment has been minimized.

Copy link

commented Dec 30, 2018

I just updated to latest git on Win 10 same problem:

PS C:\Users\Oliver\dev> degit svetlejs/template svetle-test
! could not find commit hash for master

Any more ideas?

@docmars

This comment has been minimized.

Copy link
Author

commented Dec 30, 2018

@oliverjanik Could you make sure git is on your PATH (or at least usable with the git command in your prompt?) It's possible you need to relink it after updating or installing.

@oliverjanik

This comment has been minimized.

Copy link

commented Jan 1, 2019

Yeah git is usable from the same prompt.

@osdevisnot

This comment has been minimized.

Copy link

commented Apr 3, 2019

This error manifests itself in Travis CI too. Trying to use degit there currently results in this error:

(node:5343) UnhandledPromiseRejectionWarning: Error: could not find commit hash for master
    at Degit.clone (/home/travis/build/osdevisnot/tslib-cli/node_modules/degit/index.js:170:10)
    at Object.<anonymous> (/home/travis/build/osdevisnot/tslib-cli/cli.js:39:15)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
@DerBasler

This comment has been minimized.

Copy link

commented May 11, 2019

I had the same problem using it in my wsl shell but had no problem using it in my powershell.
I was using git version 2.11.0 in my powershell and 1.9.1 in my wsl. Maybe that helps someone.

@paulocoghi

This comment has been minimized.

Copy link

commented May 11, 2019

I replaced degit with lukeed/gittar, and it's sufficient for what I need.

It isn't a pure replacement, and maybe doesn't have all the features you are using on degit, but it can suit most use cases.

@paulocoghi

This comment has been minimized.

Copy link

commented May 11, 2019

@docmars , @Rich-Harris

I think we can close this issue, because I don't think anymore that it would be the case to adapt degit to don't depend on git, because it's exactly what gittar does.

We can live with both libraries, each one with its pros and cons.

Degit has more features, but requires git. Gittar is more simple, but doesn't requires git. Each developer chooses the one it sees fit.

@osdevisnot

This comment has been minimized.

Copy link

commented May 13, 2019

Agree with @paulocoghi here. For my small project I ended up using gittar as well.

@bigidea-kz

This comment has been minimized.

Copy link

commented May 22, 2019

maybe you need to write about it in the documentation?

@cogoo

This comment has been minimized.

Copy link

commented May 22, 2019

Setting the cache value to false in the degit options solved this for me:

degit(repo, {
      cache: false,
      force: true,
      verbose: true,
    });
@paulocoghi

This comment has been minimized.

Copy link

commented May 23, 2019

@cogoo, in the most cases, this error occurs when git isn't available/installed.

@cogoo

This comment has been minimized.

Copy link

commented May 23, 2019

@cogoo, in the most cases, this error occurs when git isn't available/installed.

I have git installed. With cache: true it attempts to find the repo from a local cache, which is what caused the error for me

@paulocoghi

@jspinella

This comment has been minimized.

Copy link

commented Jun 8, 2019

Thanks for saving me some time on this one... same situation, just did a phresh install with Catalina. You'd think the error message would be a little more... helpful.

@alljamin

This comment has been minimized.

Copy link

commented Sep 24, 2019

Just updated Xcode in App Store but did not open it. Tried to run the degit and got

! could not find commit hash for master

After starting the updated Xcode for the first time it installed some components and after that, degit command worked just fine

@riazXrazor

This comment has been minimized.

Copy link

commented Sep 28, 2019

thanks @cogoo it worked !!

@vguhesan

This comment has been minimized.

Copy link

commented Sep 28, 2019

If you're seeing the following error(s):
`$ npx degit https://github.com/sveltejs/sapper-template#rollup my-app

! could not find commit hash for rollup`

or

`$ npx degit https://github.com/sveltejs/sapper-template#webpack my-app

! could not find commit hash for webpack`

It's because git isn't working. git depends on xcode and xcode requires you to accept it's license agreement.

Try running "git" and if you see the following message:
$ git Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
then type:
sudo xcodebuild -license and follow instructions for scrolling through the license agreement. At the end, you will need to type "agree" then
At that point, your original command should work fine.

Also if you haven't installed degit you may need to do the following:
sudo npm install -g degit

@masterl

This comment has been minimized.

Copy link

commented Oct 7, 2019

I have the same error with sveltejs/template.

Doc said to just run degit sveltejs/template svelte-app

Results:

$ degit sveltejs/template svelte-app
! could not find commit hash for master

What Version
Linux Manjaro 18.1.0 Juhraya
Git 2.23.0
Node 12.9.1
NPM 6.11.2
Degit 2.1.4

I use git everyday without any problems.
Cloning the svelte template repo manually works without problems.

@vguhesan

This comment has been minimized.

Copy link

commented Oct 7, 2019

@masterl did you try what I have suggested above?
#37 (comment)

@masterl

This comment has been minimized.

Copy link

commented Oct 8, 2019

@vguhesan That doesn't apply.
I'm not on a mac.
I have git installed and configured.

Everything is on the comment, I have git, node, npm, degit all installed.
As I also said above, I can clone the repo directly without any problems.

The issue seems to be on degit itself.

@paulocoghi

This comment has been minimized.

Copy link

commented Oct 8, 2019

@masterl , can you try again with cache: false ?

@masterl

This comment has been minimized.

Copy link

commented Oct 9, 2019

@paulocoghi Where do I use that?

running degit --help the cache option doesn't even have a parameter:
--cache, -c Only use local cache


I tried running with this flag, but the result was the same:

degit -c sveltejs/template svelte-app
! could not find commit hash for master
@paulocoghi

This comment has been minimized.

Copy link

commented Oct 9, 2019

@masterl , unfortunately you are right.

As mentioned by @cogoo and @riazXrazor, when using degit on code (not as cli), setting cache to false on the options may solve this problem

But it seems that we can't do the same on cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.