【问题标题】:Content of create-react-app is not pushed in githubcreate-react-app 的内容没有推送到 github
【发布时间】:2019-12-01 10:37:21
【问题描述】:

我将 go & react 代码推送到 github。

Go 代码已成功提交,但 React 代码未成功提交。

React 内容由 create-react-app 创建。

article
├ api
│  └ main.go
└ client
   └ React content made by create-react-app

image of github

这里是目标github

https://github.com/jpskgc/article

我尝试了以下命令,但没有解决。

error: the following file has staged content different from both the
file and the HEAD:
    client
(use -f to force removal)
$ git rm --cached client -f
rm 'client'

我也尝试了以下命令,但问题没有解决

$ rm -rf client/.git

客户端文件夹的内容将在 github 中提交。 但实际上并没有提交。

【问题讨论】:

  • 客户端的内容是什么?
  • 谢谢回复。内容是反应。
  • 运行git status并发布日志

标签: reactjs git github


【解决方案1】:

问题是两个目录都是 git 存储库,在这种情况下,您将拥有 submodule
你可以看到这个提交添加了一个子模块 Subproject commit 395ee793f20a65d483a50cb1d11b67e7f80729d0.
remove git submodule but keep files 按照此说明操作。

mv client subfolder_tmp
git submodule deinit client
git rm --cached client
mv subfolder_tmp client
git add client

【讨论】:

  • 谢谢回复。我已经尝试过$ rm -rf client/.git,但出现了这个问题。
【解决方案2】:

我来这篇文章可能有点太晚了。但万一有人仍然想知道如何解决它。这对我有用:

// moving to your client folder or whatever 
// the react-app folder is called
cd client
// remove the git in this folder
rm -rf client/.git

现在您回到根目录并执行添加、提交和推送。您应该将所有 react-app 文件夹推送到您想要的存储库。

【讨论】:

    猜你喜欢
    • 2018-07-06
    • 2019-03-19
    • 2017-03-17
    • 2018-06-02
    • 2021-11-29
    • 2021-10-28
    • 2020-03-31
    • 2018-02-14
    • 1970-01-01
    相关资源
    最近更新 更多