基本的 React Gatsby 项目 - 无法推送到 GitHub - 获取"git push --set-upstream origin master"



刚刚使用"Gatsby-new myproject"启动了一个基本的Gatsby项目。他们的Git设置似乎与我习惯的非常不同。项目安装后,我创建了一个新的GitHub repo,初始化了它,添加了远程,但当我尝试推送src时,我得到了:

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master

我试着设置上游,但它给了我一个错误,并说"一切都是最新的":

Enumerating objects: 51, done.
Counting objects: 100% (51/51), done.
Delta compression using up to 4 threads
Compressing objects: 100% (50/50), done.
Writing objects: 100% (51/51), 408.69 KiB | 4.21 MiB/s, done.
Total 51 (delta 12), reused 0 (delta 0)
error: RPC failed; curl 56 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date

我甚至试着重新安装这个项目,但也遇到了同样的问题。在他们的文档中似乎找不到任何信息。不确定Gatsby Git是如何设置的,以及需要做些什么才能使其正常工作。我不想用gh页面发布这个项目,现在只是想跟踪源文件的开发。有什么想法吗?

虽然运行gatsby new myproject使用git将gatsby-starter-default克隆到myproject文件夹中(然后安装依赖项(,但它实际上并没有为您创建本地git repo。

因此,您正在寻找的工作流程可能是创建一个名为myproject的GitHub repo,然后运行:

gatsby new myproject
cd myproject
git init
git add .
git commit -m "first commit"
git remote add origin git@github.com:ksav/myproject.git
git push -u origin master

最新更新