Giter VIP home page Giter VIP logo

Comments (44)

cogoo avatar cogoo commented on July 19, 2024 9

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

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

from degit.

andymerskin avatar andymerskin commented on July 19, 2024 8

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.

from degit.

Conduitry avatar Conduitry commented on July 19, 2024 5

I was just looking into getting degit to display more helpful error messages when it runs into a problem, and I found that it does display the underlying error if you call it with the verbose -v flag. Does it make sense to always display that error? I'm hoping that will eliminate a lot of questions in Svelte issues and the chatroom about this. In the meantime, now that I know this, I suppose we can tell people to run it again with -v so we can get some sort of idea of what's happening.

Edit: Or perhaps less intrusively: a gentle extra note that's displayed when there's an error with verbose mode off that the user can add -v to get more logging.

from degit.

EitharAlotoom95 avatar EitharAlotoom95 commented on July 19, 2024 5

I run this "degit sveltejs/template my-svelte-project" on git terminal not the cmd .. and it works .
just right click then choose git bash here and run the command there . I hope that will be helpful .

from degit.

cogoo avatar cogoo commented on July 19, 2024 4

@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

from degit.

thinkOfaNumber avatar thinkOfaNumber commented on July 19, 2024 3

I know this thread is covering a lot of different issues now, but I had the same "could not fetch remote":

npx degit "sveltejs/sapper-template#webpack" sapper-test
! could not fetch remote https://github.com/sveltejs/sapper-template
! could not find commit hash for webpack

but it turns out that my .gitconfig in my home directory had an invalid http proxy that I could no longer access. Hope this helps someone.

from degit.

Webzeugmacher avatar Webzeugmacher commented on July 19, 2024 2

git update helped on windows 10

from degit.

riazXrazor avatar riazXrazor commented on July 19, 2024 2

thanks @cogoo it worked !!

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024 1

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

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024 1

@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.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024 1

@bernardoadc , you are right ๐Ÿ‘ I had not thought about this possibility and, in this case, it is interesting that degit uses git.

Since gittar is a good alternative when all you want is to clone public repos, I believe that we have good options for any case.

from degit.

netaisllc avatar netaisllc commented on July 19, 2024 1

Note that Github itself has seemingly begun to default new repos to a main branch.

Today I ran into what looked like a degit issue (! could not find commit hash for master) which actually wasn't degit's problem. There indeed wasn't a master branch. As soon as I created one and ran degit again there was much joy.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024 1

A PR adding a check to see which branch is available between main and master can solve the scenario mentioned by @netaisllc .

Edit:

This PR (#243) from @fregante , provides an even better approach: read the default branch.

from degit.

glayn2bukman avatar glayn2bukman commented on July 19, 2024 1

turns out the github repo is at sveltejs/template not svelte/template and as such the command should be
npx degit sveltejs/template <your-project-name>

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

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. ๐Ÿ˜„

from degit.

oliverjanik avatar oliverjanik commented on July 19, 2024

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?

from degit.

andymerskin avatar andymerskin commented on July 19, 2024

@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.

from degit.

oliverjanik avatar oliverjanik commented on July 19, 2024

Yeah git is usable from the same prompt.

from degit.

osdevisnot avatar osdevisnot commented on July 19, 2024

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)

from degit.

DerBasler avatar DerBasler commented on July 19, 2024

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.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

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.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

@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.

from degit.

osdevisnot avatar osdevisnot commented on July 19, 2024

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

from degit.

bigidea-kz avatar bigidea-kz commented on July 19, 2024

maybe you need to write about it in the documentation?

from degit.

jspinella avatar jspinella commented on July 19, 2024

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.

from degit.

alexljamin avatar alexljamin commented on July 19, 2024

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

from degit.

vguhesan avatar vguhesan commented on July 19, 2024

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

from degit.

masterl avatar masterl commented on July 19, 2024

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.

from degit.

vguhesan avatar vguhesan commented on July 19, 2024

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

from degit.

masterl avatar masterl commented on July 19, 2024

@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.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

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

from degit.

masterl avatar masterl commented on July 19, 2024

@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

from degit.

PlkMarudny avatar PlkMarudny commented on July 19, 2024

So, how to disable caching in degit?

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

@PlkMarudny , this way:

degit(<repo_url>, {
    cache: false
});

from degit.

rollingw avatar rollingw commented on July 19, 2024

Had the same issue ... it was a certificate related issue:
https://confluence.atlassian.com/bitbucketserverkb/ssl-certificate-problem-unable-to-get-local-issuer-certificate-816521128.html
wget the right one, copy to /bin, and adjust .gitconfig in home. Worked for me

from degit.

bernardoadc avatar bernardoadc commented on July 19, 2024

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. ๐Ÿ˜„

@paulocoghi What if degit supports cloning local repos? That wouldn't work. I think we should properly display error messages so people can act to solve problems, not dodge them

from degit.

hypersundays avatar hypersundays commented on July 19, 2024

I know this thread is covering a lot of different issues now, but I had the same "could not fetch remote":

npx degit "sveltejs/sapper-template#webpack" sapper-test
! could not fetch remote https://github.com/sveltejs/sapper-template
! could not find commit hash for webpack

but it turns out that my .gitconfig in my home directory had an invalid http proxy that I could no longer access. Hope this helps someone.

I was getting this same error trying to run degit through npx. Once I installed degit globally, everything worked like a charm

from degit.

rdela avatar rdela commented on July 19, 2024

fregante's mention above of #242/#207 helped me figure my encounter with this error message out
when I ran it with the -v option per Conduitry's suggestion I got: > destination directory is empty, not helpful.
but the problem was I needed to append the branch, #trunk in this case, because this repo does not have a master branch.

from degit.

rajeeshsays avatar rajeeshsays commented on July 19, 2024

D:\ANZ104AngularDemo\ANZ104AngularDemo\angular\taskbox>degit chromaui/intro-storybook-angular-template
! could not fetch remote https://github.com/chromaui/intro-storybook-angular-template
! could not find commit hash for HEAD
Pls give a solution...

from degit.

rdela avatar rdela commented on July 19, 2024

hi @rajeeshsays, please open an issue on the repository in question, as:

npx degit chromaui/intro-storybook-svelte-template taskbox

from intro-storybook-svelte-template works fine, and the command that you presumably ran correctly in a supported environment is in their readme:

npx degit chromaui/intro-storybook-angular-template taskbox

from degit.

wangjia184 avatar wangjia184 commented on July 19, 2024

installed the latest git version 2.34.1.windows.1

Failed with same error

from degit.

pixelbadger01 avatar pixelbadger01 commented on July 19, 2024

Hello. I am getting this error:

' degit radixdlt/create-scrypto-dapp
! could not download https://github.com/radixdlt/create-scrypto-dapp/archive/75feed25fadafa73dbd8349974d755087afd44b3.tar.gz '

I took the liberty of checking the comments before me, and I can confirm Git is working so I'm just wondering what else I can look into.

Yes the URL is also fine.

from degit.

paulocoghi avatar paulocoghi commented on July 19, 2024

... it does display the underlying error if you call it with the verbose -v flag

For @NateDawg360 and everyone else: please use -v (verbose mode) to display the root cause, as already explained on the thread by Conduitry

from degit.

Visual-Dawg avatar Visual-Dawg commented on July 19, 2024

I am also getting this error while using the JS Api I am on Arch Linux, with git installed.
Setting cache to false, solves this.
Enabling verbose does not result in a more descriptive error.

Its the error in the title + that it cannot find the commit hash of the repo

from degit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.