gpt4 book ai didi

javascript - 在 git 初始化的文件夹上创建 Gatsby 项目

转载 作者:行者123 更新时间:2023-12-05 08:30:58 27 4
gpt4 key购买 nike

我有一个没有文件的 git 文件夹,所以我想使用 Gatsby CLI 在该文件夹中创建一个项目。使用 gatsby new . 但失败了,因为存储库不是空的,但它只有 .git 文件夹。我可以使用哪些替代方案来实现我的目标。

最佳答案

使用 gatsby new . 您正在设置项目名称和要克隆的启动器(默认为 this one ),在您的情况下,这是一个无效的语法,因为您正在设置既不是名字也不是启动器,所以它失败了。

来自 Gatsby docs :

There are many Enterprise level companies that maintain an internalclone of the NPM registry for security purposes. If you work for sucha company, you may find that you are able to successfully run npm install -g gatsby-cli but cannot run the gatsby new as the gatsby new command clones a repo from a public GitHubrepository. Many companies block public GitHub, which will cause thegatsby new command to fail. Not to worry, though, you can set up a newGatsby site without the gatsby new command with a few quick steps.

您可以做的一件简单的事情是使用 gatsby-cli 创建您的新项目(如 gatsby new test-project),剪切所有内容,然后将其粘贴到你想要的文件夹,它通过 .git 文件夹链接到你的存储库。

或者,您可以正常创建您的项目(gatsby new test-project),然后启动您的 git(git init)并使用以下命令将其链接到您的存储库:

git remote add origin remote <repositoryURL>
git add .
git commit -m "Initial commit"
git push -f origin master

有关添加远程的更多信息 here .

关于javascript - 在 git 初始化的文件夹上创建 Gatsby 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60883180/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com