Comments (44)
Setting the cache value to false in the degit options solved this for me:
degit(repo, {
cache: false,
force: true,
verbose: true,
});
from degit.
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.
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.
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, 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
from degit.
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.
git update helped on windows 10
from degit.
thanks @cogoo it worked !!
from degit.
@cogoo, in the most cases, this error occurs when git
isn't available/installed.
from degit.
@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.
@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.
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.
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.
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.
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.
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.
@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.
Yeah git is usable from the same prompt.
from degit.
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.
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.
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.
@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.
Agree with @paulocoghi here. For my small project I ended up using gittar as well.
from degit.
maybe you need to write about it in the documentation?
from degit.
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.
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.
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.
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.
@masterl did you try what I have suggested above?
#37 (comment)
from degit.
@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.
@masterl , can you try again with cache: false
?
from degit.
@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.
So, how to disable caching in degit?
from degit.
@PlkMarudny , this way:
degit(<repo_url>, {
cache: false
});
from degit.
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.
Would be interesting if
degit
doesn't depend ongit
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.
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.
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.
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.
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.
installed the latest git version 2.34.1.windows.1
Failed with same error
from degit.
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.
... 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.
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)
- ๐ก Feature Request: Fallback to isomorphic-git when git is not installed on the client
- This link is not downloading. HOT 2
- Throw error if subdirectory doesn't exist
- How many commits are stored in the .git history? HOT 2
- --mode=git doesn't seem to respect git hash provided to degit HOT 5
- `degit --help` not working. Help file is missing. HOT 2
- Error out of the box HOT 4
- Implementation for Private Repo HOT 1
- why install success , but use it error HOT 7
- feat: auto suggestion HOT 1
- Trying to get a subdirectory in git mode with the js api HOT 1
- Can degit handle template upgrading? HOT 2
- Archive HOT 6
- Files end of line change from crlf to lf with degit
- add support for Azure DevOps
- Issues HOT 1
- [Feature Request] Add the alias of a repo
- [suggestion] template string variables and/or project names
- Support Bitbucket Data Center (the self-managed Bitbucket)
- Degit a github subfolder without removing the /tree/main HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from degit.