Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
添加git文件夹添加不工作-获取白色箭头_Git_Github_Git Push - Fatal编程技术网

添加git文件夹添加不工作-获取白色箭头

添加git文件夹添加不工作-获取白色箭头,git,github,git-push,Git,Github,Git Push,我已经阅读了其他一些关于stackoverflow的帖子,并且意识到了这个问题,但是,我该如何解决这个问题呢?我尝试了:git rm--cached client_folder,但我得到了以下错误消息:我有同样的问题: Reinitialized existing Git repository in /Users/user/Desktop/final-8/.git/ User@User final-8 % git add client warning: adding embedded git r

我已经阅读了其他一些关于stackoverflow的帖子,并且意识到了这个问题,但是,我该如何解决这个问题呢?我尝试了:
git rm--cached client_folder
,但我得到了以下错误消息:我有同样的问题:

Reinitialized existing Git repository in /Users/user/Desktop/final-8/.git/
User@User final-8 % git add client
warning: adding embedded git repository: client
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: 
hint:   git submodule add <url> client
hint: 
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: 
hint:   git rm --cached client
hint: 
hint: See "git help submodule" for more information.

[编辑]我运行了git rm--cached-f client,我得到的是:

User final-8 % git rm --cached -f client 
**rm 'client'** 
User final-8 % git init 
Reinitialized existing Git repository in /Users//Desktop/final-8/.git/ 
User final-8 % git add client 
warning: adding embedded git repository: client 
hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. 
我再试了一次,现在我得到:

client % git rm --cached -f client
fatal: pathspec 'client' did not match any files

最后一行实际上是在
git rm
命令上打开
-f
选项的指示:

git rm --cached -f client

在评论中不太可读:你能把这个添加到你的问题主体吗?我不明白你的编辑要点?上一个命令中的提示为
client%
,在运行该命令之前您是否
cd-client
?是的,cd-client然后git-rm--cached-f client您没有
client
项,是吗?我的项目文件夹“final-8”中有一个客户端项。还有一个gitignore文件。
客户端
已经是一个(单独的)Git存储库。不能将存储库添加到存储库中;如果您要求Git这样做,您会得到上面的警告,相反,Git会向该存储库添加一个链接(所谓的gitlink),而不是实际添加存储库。这就是你看到的箭头:gitlink。如果你不想要gitlink,不要使用(子)存储库:将(子)存储库中所有有用的文件复制到非存储库的地方。如果你想要gitlink,你应该遵循Git给出的建议,使用
Git submodule add
,这样Git不仅会添加gitlink本身,还有使子模块工作所需的所有其他内容。@torek谢谢。我现在才看到这个。那么,如何将客户端文件夹中的文件推送到github呢?我设法删除了客户端文件夹,删除了客户端文件夹中的.gitignore文件,并将客户端文件夹重新添加到本地repo,然后添加到github。成功了。谢谢你的帮助。很高兴你得到了你想要的,但是记住:Git不是关于文件,而是关于提交。提交包含文件(对于子模块,提交还包含一个或多个gitlinks),当您
git push
时,您发送的是提交,而不是文件。(当然,提交包含文件,因此它们是随附的,但请记住,它始终基于提交。您要么得到一个完整的提交,要么一个也没有。)
git rm --cached -f client