[GIT:在您的rootfolder中使用CRA应用程序,如何正确推送git?

问题描述 投票:1回答:1

我对git很陌生。这可能是一个愚蠢的问题,但是我真的不知道如何解决这个问题。.我一直在寻找答案,但是我无法...

我试图使用React.js和Node.js创建我的项目。我创建了sever.js和从“ npx create-react-app客户端”创建的客户端文件夹。当我第一次推送到git时,出现了此错误消息。

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

当我强行按下它时,它就通过了,我发现我的客户端文件夹根本没有被推送到git,在回购中它只是空的。另外,我注意到客户端文件夹中有.git文件夹。(不知道cra app附带了.git文件)

在客户端文件夹中,我在命令行中键入(我用Google搜索,发现该命令将撤消.git init)

rm -rf .git

此后,我没有收到错误消息,但仍然无法将客户端文件夹推送到git,该文件夹在回购单中仍然为空。

此外,存储库中的客户端文件夹图像与其他图像不同。文件夹中有一个箭头,另一个文件夹中没有错误。enter image description here

客户端文件夹是cra app,而src文件夹具有服务器端代码。

如何将我的代码正确推送到git中?

git github git-remote
1个回答
0
投票

您首先需要删除gitlink

((special entry记录nested git repository文件夹的client的树SHA1)
© www.soinside.com 2019 - 2024. All rights reserved.