git Source Tree 和 Github 看不到我的所有文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18804380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:03:38  来源:igfitidea点击:

Source Tree and Github not seeing all of my files

gitversion-controlgithubbitbucketatlassian-sourcetree

提问by jth41

I tried creating a repository of all the files I am using in this project.

我尝试为我在这个项目中使用的所有文件创建一个存储库。

And for some reason when I added files to my local directory, only some of them were picked up by SourceTree and commited and pushed to Github.

出于某种原因,当我将文件添加到我的本地目录时,只有其中一些被 SourceTree 选取并提交并推送到 Github。

Here is what the local directory looks like (Each folder contains files):

这是本地目录的样子(每个文件夹都包含文件):

enter image description here

在此处输入图片说明

The folders boxed in red are not being seen at all by SourceTree.

SourceTree 根本看不到红色框内的文件夹。

Here is what displayed in SourceTree:

以下是 SourceTree 中显示的内容:

enter image description here

在此处输入图片说明

As you can see from the screenshot, Only the Vb.net project and the javascript project were picked up by SoruceTree. What do I need to do to pickup those other folders of files?

从截图中可以看出,SoruceTree 只选取了 Vb.net 项目和 javascript 项目。我需要怎么做才能提取那些其他文件夹的文件?

回答by Zhang Tianbao

I met the same problem, and after trying @khanmizan's method(which didn't work in my case) and searching more in the internet, I got the solution: in stead of using

我遇到了同样的问题,在尝试了@khanmizan 的方法(在我的情况下不起作用)并在互联网上搜索了更多内容后,我得到了解决方案:而不是使用

git add .

I used

我用了

git add . -f

The original answer is here: commit a file in bin directory

原答案在这里:commit a file in bin directory

回答by khanmizan

By default git will not stage sub-folder contents. you can run the following command from the root directory of your repo to stage all files.

默认情况下,git 不会暂存子文件夹内容。您可以从存储库的根目录运行以下命令来暂存所有文件。

git add .

Now all files should be displayed in source tree. However if you still find some file missing, please check the .gitignore file. by default .gitignore file blacklists all generated files like .exe .jar etc.

现在所有文件都应该显示在源树中。但是,如果您仍然发现某些文件丢失,请检查 .gitignore 文件。默认情况下,.gitignore 文件会将所有生成的文件(如 .exe .jar 等)列入黑名单。